title: symfony amazon S3 database
body: <p>I have project in Symfony 2.6 I i=use amazon S3 service and my photo upload in server amazon. I dump url photo like this: 
  <a href="https://s3-eu-west-1.amazonaws.com/aog-db-files-stage//2015/05/29/55688589ecdb4.jpg" rel="nofollow">https://s3-eu-west-1.amazonaws.com/aog-db-files-stage//2015/05/29/55688589ecdb4.jpg</a>
  and my question how I write this url in my database and read this photo for my template ? </p>
  
  <p>Entity Photo </p>
  
  <pre><code> class Photo
  {
      /**
       * @ORM\Id
       * @ORM\Column(type="integer")
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  /**
   * @ORM\Column(type="string")
   */
  private $title;
  
  /**
   * @Gedmo\Timestampable(on="create")
   * @ORM\Column(type="datetime", name="createdAt")
   */
  protected $createdAt;
  
  /**
   * @ORM\Column(name="photo_storage")
   * @Assert\File( maxSize="20M")
   */
  private $photo;
  </code></pre>
  
  <p>and I have formtype for this entity</p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('title')
          -&gt;add('photo', 'file', array(
              'label' =&gt; 'Photo',
          ))
          -&gt;getForm();
  }
  
  public function setDefaultOptions(OptionsResolverInterface $resolver)
  {
      $resolver-&gt;setDefaults(array(
          'data_class' =&gt; 'AppBundle\Entity\Photo',
      ));
  }
  
  public function getName()
  {
      return 'photo';
  }
  </code></pre>
  
  <p>and I my controller</p>
  
  <pre><code>    public function addAction(Request $request)
  {
      $em = $this-&gt;getDoctrine()-&gt;getManager();
  
      $post = new Photo();
  
      $form = $this-&gt;createForm(new AddPhotoType(), array());
  
  
      if ($request-&gt;isMethod('POST')) {
          $form-&gt;bind($request);
          if ($form-&gt;isValid()) {
              $data = $form-&gt;getData();
              $url = sprintf(
                  '%s/%s',
                  $this-&gt;container-&gt;getParameter('acme_storage.amazon_s3.base_url'),
                  $this-&gt;getPhotoUploader()-&gt;upload($data['photo'])
              );
  
              dump($url);
              $em-&gt;persist($post);
              $em-&gt;flush();
  
              return $this-&gt;redirect($this-&gt;get('router')-&gt;generate('homepage'));
          }
      }
  
      return array(
          "form" =&gt; $form-&gt;createView(),
      );
  }
  
  /**
   * @return \StorageBundle\Upload\PhotoUploader
   */
  protected function getPhotoUploader()
  {
      return $this-&gt;get('acme_storage.photo_uploader');
  }
  </code></pre>
  
  <p>how to upload photos in amazon s3 (this work) and then set url to the local database ?</p>