@@ -71,7 +71,7 @@ public function indexAction()
71
71
* to constraint the HTTP methods each controller responds to (by default
72
72
* it responds to all methods).
73
73
*/
74
- public function newAction (Request $ request, Slugger $ slugger )
74
+ public function newAction (Request $ request )
75
75
{
76
76
$ post = new Post ();
77
77
$ post ->setAuthor ($ this ->getUser ());
@@ -87,7 +87,7 @@ public function newAction(Request $request, Slugger $slugger)
87
87
// However, we explicitly add it to improve code readability.
88
88
// See https://symfony.com/doc/current/best_practices/forms.html#handling-form-submits
89
89
if ($ form ->isSubmitted () && $ form ->isValid ()) {
90
- $ post ->setSlug ($ slugger -> slugify ($ post ->getTitle ()));
90
+ $ post ->setSlug (Slugger:: slugify ($ post ->getTitle ()));
91
91
92
92
$ em = $ this ->getDoctrine ()->getManager ();
93
93
$ em ->persist ($ post );
@@ -135,15 +135,15 @@ public function showAction(Post $post)
135
135
* @Route("/{id}/edit", requirements={"id": "\d+"}, name="admin_post_edit")
136
136
* @Method({"GET", "POST"})
137
137
*/
138
- public function editAction (Request $ request , Post $ post, Slugger $ slugger )
138
+ public function editAction (Request $ request , Post $ post )
139
139
{
140
140
$ this ->denyAccessUnlessGranted ('edit ' , $ post , 'Posts can only be edited by their authors. ' );
141
141
142
142
$ form = $ this ->createForm (PostType::class, $ post );
143
143
$ form ->handleRequest ($ request );
144
144
145
145
if ($ form ->isSubmitted () && $ form ->isValid ()) {
146
- $ post ->setSlug ($ slugger -> slugify ($ post ->getTitle ()));
146
+ $ post ->setSlug (Slugger:: slugify ($ post ->getTitle ()));
147
147
$ this ->getDoctrine ()->getManager ()->flush ();
148
148
149
149
$ this ->addFlash ('success ' , 'post.updated_successfully ' );
0 commit comments