Doctrine using an id instead of passing the object
For example you get a list of IDS and you don't need to get an object querying the database, you can do just a simple trick.
$em->getReference('ENTITY',$id);
Example:
$post->setCategory('Category', $id);
or in symfony:
$post->setCategory('CompanyNameBundle:Category', $id);
Written by Gonçalo Margalho
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#