Skip to content

Update routing.rst, Replace Controller by AbstractController #10030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ like ``/blog/my-post`` or ``/blog/all-about-symfony``:
// src/Controller/BlogController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class BlogController extends Controller
class BlogController extends AbstractController
{
/**
* Matches /blog exactly
Expand Down Expand Up @@ -154,10 +154,10 @@ Symfony provides a handy way to declare localized routes without duplication.
// src/Controller/BlogController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class CompanyController extends Controller
class CompanyController extends AbstractController
{
/**
* @Route({
Expand Down Expand Up @@ -252,10 +252,10 @@ To fix this, add a *requirement* that the ``{page}`` wildcard can *only* match n
// src/Controller/BlogController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class BlogController extends Controller
class BlogController extends AbstractController
{
/**
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
Expand Down Expand Up @@ -340,10 +340,10 @@ concise, but it can decrease route readability when requirements are complex:
// src/Controller/BlogController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class BlogController extends Controller
class BlogController extends AbstractController
{
/**
* @Route("/blog/{page<\d+>}", name="blog_list")
Expand Down Expand Up @@ -416,10 +416,10 @@ So how can you make ``blog_list`` once again match when the user visits
// src/Controller/BlogController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class BlogController extends Controller
class BlogController extends AbstractController
{
/**
* @Route("/blog/{page}", name="blog_list", requirements={"page"="\d+"})
Expand Down Expand Up @@ -500,10 +500,10 @@ placeholder:
// src/Controller/BlogController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class BlogController extends Controller
class BlogController extends AbstractController
{
/**
* @Route("/blog/{page<\d+>?1}", name="blog_list")
Expand Down Expand Up @@ -596,7 +596,7 @@ With all of this in mind, check out this advanced example:
// src/Controller/ArticleController.php

// ...
class ArticleController extends Controller
class ArticleController extends AbstractController
{
/**
* @Route(
Expand Down Expand Up @@ -781,7 +781,7 @@ To generate a URL, you need to specify the name of the route (e.g. ``blog_show``
and any wildcards (e.g. ``slug = my-blog-post``) used in the path for that
route. With this information, any URL can easily be generated::

class MainController extends Controller
class MainController extends AbstractController
{
public function show($slug)
{
Expand Down