diff --git a/best_practices/controllers.rst b/best_practices/controllers.rst index 369d7be4e4c..07bdf5ebb8e 100644 --- a/best_practices/controllers.rst +++ b/best_practices/controllers.rst @@ -110,8 +110,9 @@ for the homepage of our app: */ public function indexAction() { - $em = $this->getDoctrine()->getManager(); - $posts = $em->getRepository('App:Post')->findLatest(); + $posts = $this->getDoctrine() + ->getRepository('AppBundle:Post') + ->findLatest(); return $this->render('default/index.html.twig', array( 'posts' => $posts @@ -136,6 +137,7 @@ For example: .. code-block:: php + use AppBundle\Entity\Post; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; /** @@ -146,7 +148,7 @@ For example: $deleteForm = $this->createDeleteForm($post); return $this->render('admin/post/show.html.twig', array( - 'post' => $post, + 'post' => $post, 'delete_form' => $deleteForm->createView(), )); } @@ -188,8 +190,10 @@ flexible: .. code-block:: php + use AppBundle\Entity\Post; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; + use Symfony\Component\HttpFoundation\Request; /** * @Route("/comment/{postSlug}/new", name = "comment_new")