Skip to content

Commit 6b28255

Browse files
committed
prefer @route annotation from Routing component
1 parent 278659e commit 6b28255

22 files changed

+44
-54
lines changed

best_practices/controllers.rst

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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
{

0 commit comments

Comments
 (0)