Skip to content

Added the missing annotations to a routing example #11159

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
Mar 15, 2019
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
40 changes: 40 additions & 0 deletions routing/service_container_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@ inside your routing configuration:

.. configuration-block::

.. code-block:: php-annotations

// src/AppBundle/Controller/MainController.php
namespace AppBundle\Controller;

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

class MainController extends Controller
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not extending AbstractController here which was introduced in 3.3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right ... but in 3.4 we keep extending from Controller. In 4.2 and master we extend from AbstractController.

{
/**
* @Route("/{_locale}/contact", name="contact", requirements={
* "_locale"="%app.locales%"
* })
*/
public function contactAction()
{
// ...
}
}

.. code-block:: yaml

# app/config/routing.yml
Expand Down Expand Up @@ -90,6 +111,25 @@ path):

.. configuration-block::

.. code-block:: php-annotations

// src/AppBundle/Controller/MainController.php
namespace AppBundle\Controller;

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

class MainController extends Controller
{
/**
* @Route("/%app.route_prefix%/contact", name="contact")
*/
public function contactAction()
{
// ...
}
}

.. code-block:: yaml

# app/config/routing.yml
Expand Down