title: Symfony2 Duplicate Entry - but why?
body: <p>I get following exception:</p>
  <blockquote>
  <p>An exception occurred while executing 'INSERT INTO tasks (task_title, task_description, task_priority, task_type, user) VALUES (?, ?, ?, ?, ?)' with params [&quot;efswedfgvswde&quot;, &quot;ewdfweds&quot;, &quot;Normal&quot;, 14, 13]:</p>
  <p>SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '13' for key 'UNIQ_505865978D93D649'</p>
  </blockquote>
  <p>Here I insert my form Type into the database:</p>
  <pre><code>$task = new Task();
  $form = $this-&gt;createForm(new TaskType(), $task);
  
  $form-&gt;handleRequest($request);
  
  if($form-&gt;isValid()):
  
          $em = $this-&gt;get('doctrine')-&gt;getManager();
          $em-&gt;persist($task);
          $em-&gt;flush();
  
          return  $this-&gt;redirect($this-&gt;generateUrl('add_task'));
  
  endif;
  </code></pre>
  <p>This is the field USER in my Task Entity:</p>
  <pre><code>/**
   * @var User
   * @Assert\Type(type=&quot;Seotool\MainBundle\Entity\User&quot;)
   * @ORM\OneToOne(targetEntity=&quot;User&quot;)
   * @ORM\JoinColumn(name=&quot;user&quot;, referencedColumnName=&quot;id&quot;)
   */
  protected $user;
  </code></pre>
  <p>Why is it NOT possible to add 2 entrys into the Table &quot;Task&quot; with same values of field &quot;user&quot; ? Actually in my database there is one entry with user value = 13. When I add another entry in my database with user = 13 I get this exception. Why is it? I have not defined, that User is unique ?!</p>
  <p>Thats ID from User Entity:</p>
  <pre><code>/**
   * @var integer $id
   *
   * @ORM\Column(name=&quot;id&quot;, type=&quot;integer&quot;)
   * @ORM\Id()
   * @ORM\GeneratedValue(strategy=&quot;AUTO&quot;)
   */
  private $id;
  </code></pre>