From 63c431f01dc520f001c77bbb56b9ae3b3050d4ad Mon Sep 17 00:00:00 2001 From: Gordon Franke Date: Thu, 31 Mar 2011 14:57:27 +0800 Subject: [PATCH] fix entity manager reference in repository code sample --- en/tutorials/getting-started-xml-edition.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/en/tutorials/getting-started-xml-edition.rst b/en/tutorials/getting-started-xml-edition.rst index a8b435b8c..4377592c5 100644 --- a/en/tutorials/getting-started-xml-edition.rst +++ b/en/tutorials/getting-started-xml-edition.rst @@ -1202,7 +1202,7 @@ the previoiusly discussed query functionality in it: { $dql = "SELECT b, e, r FROM Bug b JOIN b.engineer e JOIN b.reporter r ORDER BY b.created DESC"; - $query = $entityManager->createQuery($dql); + $query = $this->getEntityManager()->createQuery($dql); $query->setMaxResults($number); return $query->getResult(); } @@ -1211,7 +1211,7 @@ the previoiusly discussed query functionality in it: { $dql = "SELECT b, e, r, p FROM Bug b JOIN b.engineer e ". "JOIN b.reporter r JOIN b.products p ORDER BY b.created DESC"; - $query = $em->createQuery($dql); + $query = $this->getEntityManager()->createQuery($dql); $query->setMaxResults($number); return $query->getArrayResult(); } @@ -1221,7 +1221,7 @@ the previoiusly discussed query functionality in it: $dql = "SELECT b, e, r FROM Bug b JOIN b.engineer e JOIN b.reporter r ". "WHERE b.status = 'OPEN' AND e.id = ?1 OR r.id = ?1 ORDER BY b.created DESC"; - return $entityManager->createQuery($dql) + return $this->getEntityManager()->createQuery($dql) ->setParameter(1, $userId) ->setMaxResults($number) ->getResult(); @@ -1231,11 +1231,11 @@ the previoiusly discussed query functionality in it: { $dql = "SELECT p.id, p.name, count(b.id) AS openBugs FROM Bug b ". "JOIN b.products p WHERE b.status = 'OPEN' GROUP BY p.id"; - return $em->createQuery($dql)->getScalarResult(); + return $this->getEntityManager()->createQuery($dql)->getScalarResult(); } } -To be able to use this query logic through ``$entityManager->getRepository('Bug')`` +To be able to use this query logic through ``$this->getEntityManager()->getRepository('Bug')`` we have to adjust the metadata slightly. .. configuration-block::