Skip to content

Commit 14cc038

Browse files
committed
Merge branch '5.3' into 5.4
* 5.3: [Twig] Add PHP Attributes to routing configuration example
2 parents 5a09573 + 0f85c22 commit 14cc038

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

templates.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,30 @@ Consider the following routing configuration:
216216
}
217217
}
218218
219+
.. code-block:: php-attributes
220+
221+
// src/Controller/BlogController.php
222+
namespace App\Controller;
223+
224+
// ...
225+
use Symfony\Component\HttpFoundation\Response;
226+
use Symfony\Component\Routing\Annotation\Route;
227+
228+
class BlogController extends AbstractController
229+
{
230+
#[Route('/', name: 'blog_index')]
231+
public function index(): Response
232+
{
233+
// ...
234+
}
235+
236+
#[Route('/article/{slug}', name: 'blog_post')]
237+
public function show(string $slug): Response
238+
{
239+
// ...
240+
}
241+
}
242+
219243
.. code-block:: yaml
220244
221245
# config/routes.yaml

0 commit comments

Comments
 (0)