From d9b06dc297c8eec42345d928920d7b67dc997a2a Mon Sep 17 00:00:00 2001 From: Zairig Imad Date: Thu, 5 Apr 2018 16:40:17 +0200 Subject: [PATCH] add the new inlined routing configuration example --- routing.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/routing.rst b/routing.rst index dd90a8f5d07..4aae8fd99e0 100644 --- a/routing.rst +++ b/routing.rst @@ -521,6 +521,13 @@ With all of this in mind, check out this advanced example: public function show($_locale, $year, $slug) { } + + //or you can use the inlined routing configuration + + /** @Route("/articles/{_locale}/{year<\d+>}/{slug}/.{_format?html}") */ + public function show($_locale, $year, $slug) + { + } } .. code-block:: yaml @@ -579,6 +586,9 @@ With all of this in mind, check out this advanced example: return $routes; +.. note:: +The new syntax is {placeholder-name?defaults}, every part of it is optional and it works in all config formats (annotations, YAML and XML). + As you've seen, this route will only match if the ``{_locale}`` portion of the URL is either ``en`` or ``fr`` and if the ``{year}`` is a number. This route also shows how you can use a dot between placeholders instead of