title: missing ID/ Path on upload
body: <p>I'm trying to upload a file using Symfony2 tutorial : <a href="http://symfony.com/fr/doc/current/cookbook/doctrine/file_uploads.html" rel="nofollow">http://symfony.com/fr/doc/current/cookbook/doctrine/file_uploads.html</a></p>
  
  <p>I can choose the file, i can upload it, but the thing is, I'd like to get a unique name for every uploaded file. I tried to do so using this function :</p>
  
  <pre><code>public function upload()
  {
  if (null === $this-&gt;file)
  {
  return;
  }
  if (null !== $this-&gt;tempFilename)
  {
      $oldFile = $this-&gt;getUploadRootDir().'/'.$this-&gt;id.'.'.$this-&gt;tempFilename;
      if (file_exists($oldFile))
      {
      unlink($oldFile);
      }
  }
  $this-&gt;file-&gt;move(
  $this-&gt;getUploadRootDir(),
  $this-&gt;id.'.'.$this-&gt;path
      );
  }
  </code></pre>
  
  <p>At first, I thought this wasn't working, but it appears that $this->id and $this->path are null. I tried again, by replacing this line by</p>
  
  <pre><code>    $this-&gt;id.'.'.'test'.'.'.$this-&gt;path
  </code></pre>
  
  <p>This time, it "worked", for I could upload the file, but all of the files had the same name : ".test."</p>
  
  <p>I have no idea where this come from, since the rest of the entity was generated automatically using doctrine.</p>
  
  <pre><code>    /**
   * @var integer
   *
   * @ORM\Column(name="id", type="integer")
   * @ORM\Id
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  private $id;
  
  /**
   * @var string
   *
   * @ORM\Column(name="path", type="string", length=255, nullable=true)
   */
  private $path;
  </code></pre>