@@ -71,7 +71,7 @@ public function indexAction()
7171 * to constraint the HTTP methods each controller responds to (by default
7272 * it responds to all methods).
7373 */
74- public function newAction (Request $ request, Slugger $ slugger )
74+ public function newAction (Request $ request )
7575 {
7676 $ post = new Post ();
7777 $ post ->setAuthor ($ this ->getUser ());
@@ -87,7 +87,7 @@ public function newAction(Request $request, Slugger $slugger)
8787 // However, we explicitly add it to improve code readability.
8888 // See https://symfony.com/doc/current/best_practices/forms.html#handling-form-submits
8989 if ($ form ->isSubmitted () && $ form ->isValid ()) {
90- $ post ->setSlug ($ slugger -> slugify ($ post ->getTitle ()));
90+ $ post ->setSlug (Slugger:: slugify ($ post ->getTitle ()));
9191
9292 $ em = $ this ->getDoctrine ()->getManager ();
9393 $ em ->persist ($ post );
@@ -135,15 +135,15 @@ public function showAction(Post $post)
135135 * @Route("/{id}/edit", requirements={"id": "\d+"}, name="admin_post_edit")
136136 * @Method({"GET", "POST"})
137137 */
138- public function editAction (Request $ request , Post $ post, Slugger $ slugger )
138+ public function editAction (Request $ request , Post $ post )
139139 {
140140 $ this ->denyAccessUnlessGranted ('edit ' , $ post , 'Posts can only be edited by their authors. ' );
141141
142142 $ form = $ this ->createForm (PostType::class, $ post );
143143 $ form ->handleRequest ($ request );
144144
145145 if ($ form ->isSubmitted () && $ form ->isValid ()) {
146- $ post ->setSlug ($ slugger -> slugify ($ post ->getTitle ()));
146+ $ post ->setSlug (Slugger:: slugify ($ post ->getTitle ()));
147147 $ this ->getDoctrine ()->getManager ()->flush ();
148148
149149 $ this ->addFlash ('success ' , 'post.updated_successfully ' );
0 commit comments