From e1c8dd2483bf64b4d0dd3e2617f5b701ea19cd24 Mon Sep 17 00:00:00 2001 From: sebpacz Date: Mon, 23 Aug 2021 21:22:15 +0200 Subject: [PATCH] [Twig] Add PHP Attributes to routing configuration example --- templates.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/templates.rst b/templates.rst index 9f1f5233b34..feae769ba69 100644 --- a/templates.rst +++ b/templates.rst @@ -216,6 +216,30 @@ Consider the following routing configuration: } } + .. code-block:: php-attributes + + // src/Controller/BlogController.php + namespace App\Controller; + + // ... + use Symfony\Component\HttpFoundation\Response; + use Symfony\Component\Routing\Annotation\Route; + + class BlogController extends AbstractController + { + #[Route('/', name: 'blog_index')] + public function index(): Response + { + // ... + } + + #[Route('/article/{slug}', name: 'blog_post')] + public function show(string $slug): Response + { + // ... + } + } + .. code-block:: yaml # config/routes.yaml