Skip to content

Commit fc17e9f

Browse files
committed
minor #10030 Update routing.rst, Replace Controller by AbstractController (OlivierToussaint)
This PR was merged into the 4.1 branch. Discussion ---------- Update routing.rst, Replace Controller by AbstractController Remplace Controller by AbstractController Commits ------- 8ae75a6 Update routing.rst
2 parents aac7d76 + 8ae75a6 commit fc17e9f

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

routing.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ like ``/blog/my-post`` or ``/blog/all-about-symfony``:
3737
// src/Controller/BlogController.php
3838
namespace App\Controller;
3939
40-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
40+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
4141
use Symfony\Component\Routing\Annotation\Route;
4242
43-
class BlogController extends Controller
43+
class BlogController extends AbstractController
4444
{
4545
/**
4646
* Matches /blog exactly
@@ -154,10 +154,10 @@ Symfony provides a handy way to declare localized routes without duplication.
154154
// src/Controller/BlogController.php
155155
namespace App\Controller;
156156
157-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
157+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
158158
use Symfony\Component\Routing\Annotation\Route;
159159
160-
class CompanyController extends Controller
160+
class CompanyController extends AbstractController
161161
{
162162
/**
163163
* @Route({
@@ -252,10 +252,10 @@ To fix this, add a *requirement* that the ``{page}`` wildcard can *only* match n
252252
// src/Controller/BlogController.php
253253
namespace App\Controller;
254254
255-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
255+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
256256
use Symfony\Component\Routing\Annotation\Route;
257257
258-
class BlogController extends Controller
258+
class BlogController extends AbstractController
259259
{
260260
/**
261261
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
@@ -340,10 +340,10 @@ concise, but it can decrease route readability when requirements are complex:
340340
// src/Controller/BlogController.php
341341
namespace App\Controller;
342342
343-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
343+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
344344
use Symfony\Component\Routing\Annotation\Route;
345345
346-
class BlogController extends Controller
346+
class BlogController extends AbstractController
347347
{
348348
/**
349349
* @Route("/blog/{page<\d+>}", name="blog_list")
@@ -416,10 +416,10 @@ So how can you make ``blog_list`` once again match when the user visits
416416
// src/Controller/BlogController.php
417417
namespace App\Controller;
418418
419-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
419+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
420420
use Symfony\Component\Routing\Annotation\Route;
421421
422-
class BlogController extends Controller
422+
class BlogController extends AbstractController
423423
{
424424
/**
425425
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
@@ -500,10 +500,10 @@ placeholder:
500500
// src/Controller/BlogController.php
501501
namespace App\Controller;
502502
503-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
503+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
504504
use Symfony\Component\Routing\Annotation\Route;
505505
506-
class BlogController extends Controller
506+
class BlogController extends AbstractController
507507
{
508508
/**
509509
* @Route("/blog/{page<\d+>?1}", name="blog_list")
@@ -596,7 +596,7 @@ With all of this in mind, check out this advanced example:
596596
// src/Controller/ArticleController.php
597597
598598
// ...
599-
class ArticleController extends Controller
599+
class ArticleController extends AbstractController
600600
{
601601
/**
602602
* @Route(
@@ -781,7 +781,7 @@ To generate a URL, you need to specify the name of the route (e.g. ``blog_show``
781781
and any wildcards (e.g. ``slug = my-blog-post``) used in the path for that
782782
route. With this information, any URL can easily be generated::
783783

784-
class MainController extends Controller
784+
class MainController extends AbstractController
785785
{
786786
public function show($slug)
787787
{

0 commit comments

Comments
 (0)