Hola,
he creado un controller para acceder a la entity Vocabulary (
https://gist.github.com/2882371) que tiene una relación OneToMany con la entity Term (
https://gist.github.com/2882378).
este es el código del controller:
public function showAction($vid)
{
$em = $this->getDoctrine()->getEntityManager();
$vocabulary = $em->getRepository('StanoSasTaxonomyBundle:Vocabulary')->find($vid);
if (!$vocabulary){
throw $this->createNotFoundException('Unable to find Vocabulary.');
}
$terms = $vocabulary->getTerms();
return $this->render('StanoSasTaxonomyBundle:Vocabulary:show.html.twig', array(
'vocabulary' => $vocabulary,
'terms' => $terms
));
}
funciona y todo, pero... si miro el profiler Symfony2 en el apartado Queries me dice que genera 5 queries:
https://gist.github.com/2882328yo entiendo las primeras 3, pero porqué la 4 y la 5 son como duplicadas?
gracias por el ayuda!
un saludo,
enrico