title: How to set the id of a foreign key id?
body: <p>Based on this post: <a href="https://stackoverflow.com/questions/11539789/how-to-set-the-id-of-a-foreign-key-id-sf2-doctrine2">How to set the id of a foreign key id #sf2 #doctrine2</a></p>
  
  <p>In the previous post I found this solution </p>
  
  <pre><code>class Item
  {
  /**
   * @ORM\ManyToOne(targetEntity="MyBundle\Entity\ItemType", inversedBy="itemTypes")
   * @ORM\JoinColumn(name="type_id", referencedColumnName="id")
   */
  protected $item_type;
  /**
   * 
   * @var string $item_type_id
   * @ORM\Column(type="integer")
   */
  protected $item_type_id;
  }
  .... Setter &amp; Getter
  }
  </code></pre>
  
  <p>Which allows me to do something like that</p>
  
  <pre><code>$item = new Item();
  $item-&gt;setItemTypeId(2); // Assuming that the ItemType with id 2 exists.
  </code></pre>
  
  <p>But from the last update of doctrine2.3 it's not working anymore.</p>
  
  <p>when I persist the item(so creating the INSERT SQL query), it does not set the item_type_id field. only all other fields.</p>
  
  <p>Any idea how to set manually the item_type_id without retrieve the ItemType just before setting it ? it's quite over use of queries !?</p>
  
  <pre><code>$item = new Item();
  $itemType = $this-&gt;entity_manager-&gt;getRepository('Acme\MyBundle:ItemType')-&gt;find(2);
  $item-&gt;setItemType($itemType); // Assuming that the ItemType with id 2 exists.
  </code></pre>