title: Best practice for inserting objects with foreign keys in symfony2
body: <p>What should be the best practice to insert a foreign key in an object in symfony2, if i already have the id of the foreign key?</p>
  
  <p>If i have an action:</p>
  
  <pre><code>/**
  * @Route("assignCategory/{category}/product/{product}")
  */
  public function assignCategory($category, $product)
  {
     ...
     // here i should set the category to the existing product
     ...
  }
  </code></pre>
  
  <p>I don't like the idea of retrieving the category from the database.</p>
  
  <p>This also applies if you have ids in session and you want to store them to the object but without retrieving it from the database... so... what should be the best practice for this?</p>