Is it possible to get an entity without loading its associated entities using findOneById()
? In some cases such as just checking the entity exists or not, I don't need to load all of its associated entities, for example,
$entity = $em->getRepository('EstateBundle:MyEntity')->findOneById($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find the entity.');
}
Otherwise, I think it could lead to performance issue. In CakePHP, it is possible using an option recursive
. I'm looking for such kind of option in Symfony and Doctrine. I think this is a common question, but I can't find any documentation about this.