Skip to content

Commit 8b4b418

Browse files
committed
minor #10150 stop using the deprecated @method annotation (xabbuh)
This PR was merged into the 2.8 branch. Discussion ---------- stop using the deprecated @method annotation I think we should use the `@Route` annotation from the Routing component instead of the one from SensioFrameworkExtraBundle (fixes #10142). Commits ------- 4e1496d stop using the deprecated @method annotation
2 parents 82043da + 4e1496d commit 8b4b418

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

quick_tour/the_controller.rst

-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ as its default value::
115115

116116
// src/AppBundle/Controller/DefaultController.php
117117
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
118-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
119118

120119
// ...
121120

@@ -154,7 +153,6 @@ option of the ``@Route()`` annotation::
154153

155154
// src/AppBundle/Controller/DefaultController.php
156155
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
157-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
158156

159157
// ...
160158

routing/custom_route_loader.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Loading Routes
2929
The routes in a Symfony application are loaded by the
3030
:class:`Symfony\\Bundle\\FrameworkBundle\\Routing\\DelegatingLoader`.
3131
This loader uses several other loaders (delegates) to load resources of
32-
different types, for instance YAML files or ``@Route`` and ``@Method`` annotations
32+
different types, for instance YAML files or ``@Route`` annotations
3333
in controller files. The specialized loaders implement
3434
:class:`Symfony\\Component\\Config\\Loader\\LoaderInterface`
3535
and therefore have two important methods:

routing/requirements.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -187,23 +187,20 @@ accomplished with the following route configuration:
187187
// src/AppBundle/Controller/BlogApiController.php
188188
namespace AppBundle\Controller;
189189
190-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
191190
// ...
192191
193192
class BlogApiController extends Controller
194193
{
195194
/**
196-
* @Route("/api/posts/{id}")
197-
* @Method({"GET","HEAD"})
195+
* @Route("/api/posts/{id}", methods={"GET","HEAD"})
198196
*/
199197
public function showAction($id)
200198
{
201199
// ... return a JSON response with the post
202200
}
203201
204202
/**
205-
* @Route("/api/posts/{id}")
206-
* @Method("PUT")
203+
* @Route("/api/posts/{id}", methods={"PUT"})
207204
*/
208205
public function editAction($id)
209206
{

service_container/autowiring.rst

+3-8
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ Here is a typical controller using the ``twitter_client`` service::
106106
namespace Acme\Controller;
107107

108108
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
109-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
110109
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
111110
use Symfony\Component\HttpFoundation\Request;
112111
use Symfony\Component\HttpFoundation\Response;
@@ -115,8 +114,7 @@ Here is a typical controller using the ``twitter_client`` service::
115114
class DefaultController extends Controller
116115
{
117116
/**
118-
* @Route("/tweet")
119-
* @Method("POST")
117+
* @Route("/tweet", methods={"POST"})
120118
*/
121119
public function tweetAction(Request $request)
122120
{
@@ -259,7 +257,6 @@ transformer::
259257
namespace Acme\Controller;
260258

261259
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
262-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
263260
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
264261
use Symfony\Component\HttpFoundation\Request;
265262
use Symfony\Component\HttpFoundation\Response;
@@ -268,17 +265,15 @@ transformer::
268265
class DefaultController extends Controller
269266
{
270267
/**
271-
* @Route("/tweet")
272-
* @Method("POST")
268+
* @Route("/tweet", methods={"POST"})
273269
*/
274270
public function tweetAction(Request $request)
275271
{
276272
return $this->tweet($request, 'twitter_client');
277273
}
278274

279275
/**
280-
* @Route("/tweet-uppercase")
281-
* @Method("POST")
276+
* @Route("/tweet-uppercase", methods={"POST"})
282277
*/
283278
public function tweetUppercaseAction(Request $request)
284279
{

0 commit comments

Comments
 (0)