15
15
use App \Form \PostType ;
16
16
use App \Repository \PostRepository ;
17
17
use App \Utils \Slugger ;
18
- use Sensio \Bundle \FrameworkExtraBundle \Configuration \Method ;
19
18
use Sensio \Bundle \FrameworkExtraBundle \Configuration \Security ;
20
19
use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
21
20
use Symfony \Component \Form \Extension \Core \Type \SubmitType ;
@@ -51,9 +50,8 @@ class BlogController extends AbstractController
51
50
* could move this annotation to any other controller while maintaining
52
51
* the route name and therefore, without breaking any existing link.
53
52
*
54
- * @Route("/", name="admin_index")
55
- * @Route("/", name="admin_post_index")
56
- * @Method("GET")
53
+ * @Route("/", methods={"GET"}, name="admin_index")
54
+ * @Route("/", methods={"GET"}, name="admin_post_index")
57
55
*/
58
56
public function index (PostRepository $ posts ): Response
59
57
{
@@ -65,8 +63,7 @@ public function index(PostRepository $posts): Response
65
63
/**
66
64
* Creates a new Post entity.
67
65
*
68
- * @Route("/new", name="admin_post_new")
69
- * @Method({"GET", "POST"})
66
+ * @Route("/new", methods={"GET", "POST"}, name="admin_post_new")
70
67
*
71
68
* NOTE: the Method annotation is optional, but it's a recommended practice
72
69
* to constraint the HTTP methods each controller responds to (by default
@@ -116,8 +113,7 @@ public function new(Request $request): Response
116
113
/**
117
114
* Finds and displays a Post entity.
118
115
*
119
- * @Route("/{id}", requirements={"id": "\d+"}, name="admin_post_show")
120
- * @Method("GET")
116
+ * @Route("/{id}", requirements={"id": "\d+"}, methods={"GET"}, name="admin_post_show")
121
117
*/
122
118
public function show (Post $ post ): Response
123
119
{
@@ -133,8 +129,7 @@ public function show(Post $post): Response
133
129
/**
134
130
* Displays a form to edit an existing Post entity.
135
131
*
136
- * @Route("/{id}/edit", requirements={"id": "\d+"}, name="admin_post_edit")
137
- * @Method({"GET", "POST"})
132
+ * @Route("/{id}/edit", requirements={"id": "\d+"}, methods={"GET", "POST"}, name="admin_post_edit")
138
133
*/
139
134
public function edit (Request $ request , Post $ post ): Response
140
135
{
@@ -161,8 +156,7 @@ public function edit(Request $request, Post $post): Response
161
156
/**
162
157
* Deletes a Post entity.
163
158
*
164
- * @Route("/{id}/delete", name="admin_post_delete")
165
- * @Method("POST")
159
+ * @Route("/{id}/delete", methods={"POST"}, name="admin_post_delete")
166
160
* @Security("is_granted('delete', post)")
167
161
*
168
162
* The Security annotation value is an expression (if it evaluates to false,
0 commit comments