Skip to content

Commit 853c4a1

Browse files
OlivierToussaintGuikingone
authored andcommitted
Update routing.rst
Remplace Controller by AbstractController
1 parent 9f1ec91 commit 853c4a1

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
@@ -31,10 +31,10 @@ like ``/blog/my-post`` or ``/blog/all-about-symfony``:
3131
// src/Controller/BlogController.php
3232
namespace App\Controller;
3333
34-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
34+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
3535
use Symfony\Component\Routing\Annotation\Route;
3636
37-
class BlogController extends Controller
37+
class BlogController extends AbstractController
3838
{
3939
/**
4040
* Matches /blog exactly
@@ -148,10 +148,10 @@ Symfony provides a handy way to declare localized routes without duplication.
148148
// src/Controller/BlogController.php
149149
namespace App\Controller;
150150
151-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
151+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
152152
use Symfony\Component\Routing\Annotation\Route;
153153
154-
class CompanyController extends Controller
154+
class CompanyController extends AbstractController
155155
{
156156
/**
157157
* @Route({
@@ -246,10 +246,10 @@ To fix this, add a *requirement* that the ``{page}`` wildcard can *only* match n
246246
// src/Controller/BlogController.php
247247
namespace App\Controller;
248248
249-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
249+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
250250
use Symfony\Component\Routing\Annotation\Route;
251251
252-
class BlogController extends Controller
252+
class BlogController extends AbstractController
253253
{
254254
/**
255255
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
@@ -334,10 +334,10 @@ concise, but it can decrease route readability when requirements are complex:
334334
// src/Controller/BlogController.php
335335
namespace App\Controller;
336336
337-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
337+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
338338
use Symfony\Component\Routing\Annotation\Route;
339339
340-
class BlogController extends Controller
340+
class BlogController extends AbstractController
341341
{
342342
/**
343343
* @Route("/blog/{page<\d+>}", name="blog_list")
@@ -410,10 +410,10 @@ So how can you make ``blog_list`` once again match when the user visits
410410
// src/Controller/BlogController.php
411411
namespace App\Controller;
412412
413-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
413+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
414414
use Symfony\Component\Routing\Annotation\Route;
415415
416-
class BlogController extends Controller
416+
class BlogController extends AbstractController
417417
{
418418
/**
419419
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
@@ -494,10 +494,10 @@ placeholder:
494494
// src/Controller/BlogController.php
495495
namespace App\Controller;
496496
497-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
497+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
498498
use Symfony\Component\Routing\Annotation\Route;
499499
500-
class BlogController extends Controller
500+
class BlogController extends AbstractController
501501
{
502502
/**
503503
* @Route("/blog/{page<\d+>?1}", name="blog_list")
@@ -590,7 +590,7 @@ With all of this in mind, check out this advanced example:
590590
// src/Controller/ArticleController.php
591591
592592
// ...
593-
class ArticleController extends Controller
593+
class ArticleController extends AbstractController
594594
{
595595
/**
596596
* @Route(
@@ -775,7 +775,7 @@ To generate a URL, you need to specify the name of the route (e.g. ``blog_show``
775775
and any wildcards (e.g. ``slug = my-blog-post``) used in the path for that
776776
route. With this information, any URL can easily be generated::
777777

778-
class MainController extends Controller
778+
class MainController extends AbstractController
779779
{
780780
public function show($slug)
781781
{

0 commit comments

Comments
 (0)