Skip to content

Commit 18fa2c6

Browse files
ifdatticwouterj
authored andcommitted
Misc changes
1 parent cad4d3f commit 18fa2c6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

best_practices/controllers.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ for the homepage of our app:
110110
*/
111111
public function indexAction()
112112
{
113-
$em = $this->getDoctrine()->getManager();
114-
$posts = $em->getRepository('App:Post')->findLatest();
113+
$posts = $this->getDoctrine()
114+
->getRepository('AppBundle:Post')
115+
->findLatest();
115116
116117
return $this->render('default/index.html.twig', array(
117118
'posts' => $posts
@@ -136,6 +137,7 @@ For example:
136137

137138
.. code-block:: php
138139
140+
use AppBundle\Entity\Post;
139141
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
140142
141143
/**
@@ -146,7 +148,7 @@ For example:
146148
$deleteForm = $this->createDeleteForm($post);
147149
148150
return $this->render('admin/post/show.html.twig', array(
149-
'post' => $post,
151+
'post' => $post,
150152
'delete_form' => $deleteForm->createView(),
151153
));
152154
}
@@ -188,8 +190,10 @@ flexible:
188190

189191
.. code-block:: php
190192
193+
use AppBundle\Entity\Post;
191194
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
192195
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
196+
use Symfony\Component\HttpFoundation\Request;
193197
194198
/**
195199
* @Route("/comment/{postSlug}/new", name = "comment_new")

0 commit comments

Comments
 (0)