Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6b28255

Browse filesBrowse files
committed
prefer @route annotation from Routing component
1 parent 278659e commit 6b28255
Copy full SHA for 6b28255
Expand file treeCollapse file tree

22 files changed

+44
-54
lines changed

‎best_practices/controllers.rst

Copy file name to clipboardExpand all lines: best_practices/controllers.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ for the homepage of our app::
9595

9696
use AppBundle\Entity\Post;
9797
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
98-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
98+
use Symfony\Component\Routing\Annotation\Route;
9999

100100
class DefaultController extends Controller
101101
{
@@ -130,7 +130,7 @@ to automatically query for an entity and pass it as an argument to your controll
130130
For example::
131131

132132
use AppBundle\Entity\Post;
133-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
133+
use Symfony\Component\Routing\Annotation\Route;
134134

135135
/**
136136
* @Route("/{id}", name="admin_post_show")
@@ -179,9 +179,9 @@ You can also use the ``@ParamConverter`` configuration, which is infinitely
179179
flexible::
180180

181181
use AppBundle\Entity\Post;
182-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
183182
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
184183
use Symfony\Component\HttpFoundation\Request;
184+
use Symfony\Component\Routing\Annotation\Route;
185185

186186
/**
187187
* @Route("/comment/{postSlug}/new", name="comment_new")

‎best_practices/security.rst

Copy file name to clipboardExpand all lines: best_practices/security.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ Using ``@Security``, this looks like:
109109

110110
.. code-block:: php
111111
112-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
113112
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
113+
use Symfony\Component\Routing\Annotation\Route;
114114
// ...
115115
116116
/**
@@ -133,8 +133,8 @@ controller if their email matches the value returned by the ``getAuthorEmail()``
133133
method on the ``Post`` object::
134134

135135
use AppBundle\Entity\Post;
136-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
137136
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
137+
use Symfony\Component\Routing\Annotation\Route;
138138

139139
/**
140140
* @Route("/{id}/edit", name="admin_post_edit")

‎configuration/micro_kernel_trait.rst

Copy file name to clipboardExpand all lines: configuration/micro_kernel_trait.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ has one file in it::
254254
namespace App\Controller;
255255

256256
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
257-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
257+
use Symfony\Component\Routing\Annotation\Route;
258258

259259
class MicroController extends Controller
260260
{

‎controller.rst

Copy file name to clipboardExpand all lines: controller.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ This renders a page that prints a lucky (random) number::
1616
// src/AppBundle/Controller/LuckyController.php
1717
namespace AppBundle\Controller;
1818

19-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
2019
use Symfony\Component\HttpFoundation\Response;
20+
use Symfony\Component\Routing\Annotation\Route;
2121

2222
class LuckyController
2323
{
@@ -59,7 +59,7 @@ class::
5959
namespace AppBundle\Controller;
6060

6161
use Symfony\Component\HttpFoundation\Response;
62-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
62+
use Symfony\Component\Routing\Annotation\Route;
6363

6464
class LuckyController
6565
{

‎controller/upload_file.rst

Copy file name to clipboardExpand all lines: controller/upload_file.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ Finally, you need to update the code of the controller that handles the form::
9999
// src/AppBundle/Controller/ProductController.php
100100
namespace AppBundle\Controller;
101101

102-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
103102
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
104103
use Symfony\Component\HttpFoundation\Request;
104+
use Symfony\Component\Routing\Annotation\Route;
105105
use AppBundle\Entity\Product;
106106
use AppBundle\Form\ProductType;
107107

‎doctrine/registration_form.rst

Copy file name to clipboardExpand all lines: doctrine/registration_form.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ into the database::
239239

240240
use AppBundle\Form\UserType;
241241
use AppBundle\Entity\User;
242-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
243242
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
244243
use Symfony\Component\HttpFoundation\Request;
244+
use Symfony\Component\Routing\Annotation\Route;
245245

246246
class RegistrationController extends Controller
247247
{

‎page_creation.rst

Copy file name to clipboardExpand all lines: page_creation.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ random) number and prints it. To do that, create a "Controller class" and a
4343
// src/AppBundle/Controller/LuckyController.php
4444
namespace AppBundle\Controller;
4545

46-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
4746
use Symfony\Component\HttpFoundation\Response;
47+
use Symfony\Component\Routing\Annotation\Route;
4848

4949
class LuckyController
5050
{

‎quick_tour/the_big_picture.rst

Copy file name to clipboardExpand all lines: quick_tour/the_big_picture.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ because that will be explained in the next section)::
5151

5252
namespace AppBundle\Controller;
5353

54-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
5554
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
55+
use Symfony\Component\Routing\Annotation\Route;
5656

5757
class DefaultController extends Controller
5858
{
@@ -95,8 +95,8 @@ at the three lines of code above the ``indexAction()`` method::
9595
// src/AppBundle/Controller/DefaultController.php
9696
namespace AppBundle\Controller;
9797

98-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9998
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
99+
use Symfony\Component\Routing\Annotation\Route;
100100

101101
class DefaultController extends Controller
102102
{

‎quick_tour/the_controller.rst

Copy file name to clipboardExpand all lines: quick_tour/the_controller.rst
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ text content::
2222
// src/AppBundle/Controller/DefaultController.php
2323
namespace AppBundle\Controller;
2424

25-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
2625
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
2726
use Symfony\Component\HttpFoundation\Response;
27+
use Symfony\Component\Routing\Annotation\Route;
2828

2929
class DefaultController extends Controller
3030
{
@@ -57,8 +57,8 @@ a new method called ``helloAction()`` with the following content::
5757
// src/AppBundle/Controller/DefaultController.php
5858
namespace AppBundle\Controller;
5959

60-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6160
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
61+
use Symfony\Component\Routing\Annotation\Route;
6262

6363
class DefaultController extends Controller
6464
{
@@ -114,8 +114,7 @@ Tweak the ``hello`` route by adding a new ``_format`` variable with ``html``
114114
as its default value::
115115

116116
// src/AppBundle/Controller/DefaultController.php
117-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
118-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
117+
use Symfony\Component\Routing\Annotation\Route;
119118

120119
// ...
121120

@@ -153,8 +152,7 @@ To restrict the formats supported by a given action, use the ``requirements``
153152
option of the ``@Route()`` annotation::
154153

155154
// src/AppBundle/Controller/DefaultController.php
156-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
157-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
155+
use Symfony\Component\Routing\Annotation\Route;
158156

159157
// ...
160158

@@ -254,9 +252,9 @@ forget to add the new ``use`` statement that imports this ``Request`` class)::
254252
// src/AppBundle/Controller/DefaultController.php
255253
namespace AppBundle\Controller;
256254

257-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
258255
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
259256
use Symfony\Component\HttpFoundation\Request;
257+
use Symfony\Component\Routing\Annotation\Route;
260258

261259
class DefaultController extends Controller
262260
{

‎routing.rst

Copy file name to clipboardExpand all lines: routing.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The route is simple:
4040
namespace AppBundle\Controller;
4141
4242
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
43-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
43+
use Symfony\Component\Routing\Annotation\Route;
4444
4545
class BlogController extends Controller
4646
{
@@ -174,7 +174,7 @@ To fix this, add a *requirement* that the ``{page}`` wildcard can *only* match n
174174
namespace AppBundle\Controller;
175175
176176
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
177-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
177+
use Symfony\Component\Routing\Annotation\Route;
178178
179179
class BlogController extends Controller
180180
{
@@ -272,7 +272,7 @@ So how can you make ``blog_list`` once again match when the user visits
272272
namespace AppBundle\Controller;
273273
274274
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
275-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
275+
use Symfony\Component\Routing\Annotation\Route;
276276
277277
class BlogController extends Controller
278278
{

‎routing/custom_route_loader.rst

Copy file name to clipboardExpand all lines: routing/custom_route_loader.rst
+1-1Lines changed: 1 addition & 1 deletion
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/external_resources.rst

Copy file name to clipboardExpand all lines: routing/external_resources.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ suppose you want to prefix all routes in the AppBundle with ``/site`` (e.g.
9898

9999
.. code-block:: php-annotations
100100
101-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
101+
use Symfony\Component\Routing\Annotation\Route;
102102
103103
/**
104104
* @Route("/site")

‎routing/hostname_pattern.rst

Copy file name to clipboardExpand all lines: routing/hostname_pattern.rst
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can also match on the HTTP *host* of the incoming request.
1414
namespace Acme\DemoBundle\Controller;
1515
1616
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
17-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
17+
use Symfony\Component\Routing\Annotation\Route;
1818
1919
class MainController extends Controller
2020
{
@@ -96,7 +96,7 @@ you can use placeholders in your hostname:
9696
namespace Acme\DemoBundle\Controller;
9797
9898
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
99-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
99+
use Symfony\Component\Routing\Annotation\Route;
100100
101101
class MainController extends Controller
102102
{
@@ -173,7 +173,7 @@ instance, if you want to match both ``m.example.com`` and
173173
namespace Acme\DemoBundle\Controller;
174174
175175
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
176-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
176+
use Symfony\Component\Routing\Annotation\Route;
177177
178178
class MainController extends Controller
179179
{
@@ -266,7 +266,7 @@ instance, if you want to match both ``m.example.com`` and
266266
namespace Acme\DemoBundle\Controller;
267267
268268
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
269-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
269+
use Symfony\Component\Routing\Annotation\Route;
270270
271271
class MainController extends Controller
272272
{
@@ -367,7 +367,7 @@ You can also set the host option on imported routes:
367367
namespace Acme\HelloBundle\Controller;
368368
369369
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
370-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
370+
use Symfony\Component\Routing\Annotation\Route;
371371
372372
/**
373373
* @Route(host="hello.example.com")

‎routing/redirect_trailing_slash.rst

Copy file name to clipboardExpand all lines: routing/redirect_trailing_slash.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ system, as explained below:
4444
// src/AppBundle/Controller/RedirectingController.php
4545
namespace AppBundle\Controller;
4646
47-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
4847
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
4948
use Symfony\Component\HttpFoundation\Request;
49+
use Symfony\Component\Routing\Annotation\Route;
5050
5151
class RedirectingController extends Controller
5252
{

‎routing/requirements.rst

Copy file name to clipboardExpand all lines: routing/requirements.rst
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ a routing ``{wildcard}`` to only match some regular expression:
1616
namespace AppBundle\Controller;
1717
1818
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
19-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
19+
use Symfony\Component\Routing\Annotation\Route;
2020
2121
class BlogController extends Controller
2222
{
@@ -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
{

‎routing/scheme.rst

Copy file name to clipboardExpand all lines: routing/scheme.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ the URI scheme via schemes:
1616
namespace AppBundle\Controller;
1717
1818
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
19-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
19+
use Symfony\Component\Routing\Annotation\Route;
2020
2121
class MainController extends Controller
2222
{

‎routing/slash_in_parameter.rst

Copy file name to clipboardExpand all lines: routing/slash_in_parameter.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ a more permissive regular expression for it:
2626

2727
.. code-block:: php-annotations
2828
29-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
29+
use Symfony\Component\Routing\Annotation\Route;
3030
3131
class DefaultController
3232
{

‎security.rst

Copy file name to clipboardExpand all lines: security.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ example, if you use annotations, create something like this::
189189
// src/AppBundle/Controller/DefaultController.php
190190
// ...
191191

192-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
193192
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
194193
use Symfony\Component\HttpFoundation\Response;
194+
use Symfony\Component\Routing\Annotation\Route;
195195

196196
class DefaultController extends Controller
197197
{

‎security/form_login_setup.rst

Copy file name to clipboardExpand all lines: security/form_login_setup.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ configuration (``login``):
9191
// src/AppBundle/Controller/SecurityController.php
9292
9393
// ...
94-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
94+
use Symfony\Component\Routing\Annotation\Route;
9595
9696
class SecurityController extends Controller
9797
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.