From e18236c84206b5a2ef982bd981cf87d8754cf58a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 14 Mar 2019 15:25:06 +0100 Subject: [PATCH] Added the missing annotations to a routing example --- routing/service_container_parameters.rst | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/routing/service_container_parameters.rst b/routing/service_container_parameters.rst index 9777f18bb23..cfdd4f4d140 100644 --- a/routing/service_container_parameters.rst +++ b/routing/service_container_parameters.rst @@ -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 + { + /** + * @Route("/{_locale}/contact", name="contact", requirements={ + * "_locale"="%app.locales%" + * }) + */ + public function contactAction() + { + // ... + } + } + .. code-block:: yaml # app/config/routing.yml @@ -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