diff --git a/book/routing.rst b/book/routing.rst index 2c611da0336..d00ed9c0fff 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1526,6 +1526,6 @@ should also be used to generate URLs. Learn more from the Cookbook ---------------------------- -* :doc:`/cookbook/routing/scheme` +* :doc:`/cookbook/routing/index` .. _`FOSJsRoutingBundle`: https://github.com/FriendsOfSymfony/FOSJsRoutingBundle diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 5ba5d97ff1c..5439da91d2a 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -150,6 +150,8 @@ * :doc:`/cookbook/routing/custom_route_loader` * :doc:`/cookbook/routing/redirect_trailing_slash` * :doc:`/cookbook/routing/extra_information` + * :doc:`/cookbook/routing/extending_routing` + * :doc:`/cookbook/routing/multiple_routers` * :doc:`Security Authentication (Identifying/Logging in the User) ` diff --git a/cookbook/routing/extending_routing.rst b/cookbook/routing/extending_routing.rst new file mode 100644 index 00000000000..5e261bc23a1 --- /dev/null +++ b/cookbook/routing/extending_routing.rst @@ -0,0 +1,15 @@ +Extending the Routing System +============================ + +The routing system has several extension points: + +* You can use the ``@ParamConverter`` mechanism of FrameworkExtraBundle_ + to convert controller arguments into objects. +* You can write :doc:`custom route loaders `; +* You can write your own ``Router`` instance and + :doc:`combine several routers `; +* Some bundles overwrite core routing services to alter the route loading + process, e.g. JmsI18nRoutingBundle_. + +.. _FrameworkExtraBundle: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html +.. _JMSI18nRoutingBundle: https://github.com/schmittjoh/JMSI18nRoutingBundle diff --git a/cookbook/routing/index.rst b/cookbook/routing/index.rst index c42cff1748d..965c10924c5 100644 --- a/cookbook/routing/index.rst +++ b/cookbook/routing/index.rst @@ -9,6 +9,8 @@ Routing redirect_in_config method_parameters service_container_parameters - custom_route_loader redirect_trailing_slash extra_information + extending_routing + custom_route_loader + multiple_routers diff --git a/cookbook/routing/multiple_routers.rst b/cookbook/routing/multiple_routers.rst new file mode 100644 index 00000000000..e6b62ad8366 --- /dev/null +++ b/cookbook/routing/multiple_routers.rst @@ -0,0 +1,19 @@ +.. index:: + single: Routing; Multiple Routers + +Using the Symfony CMF ChainRouter to Combine Multiple Routers +============================================================= + +The Symfony CMF ``ChainRouter`` allows to use more than one router. A main +use case is to keep the :doc:`default symfony routing system ` +available when writing a custom router. + +.. caution:: + + If you simply need a way to load routes determined in a different + way, using :doc:`a custom route loader ` is + simpler than writing your own controller. + Writing a custom controller is justified when the routes can not be + statically determined. + +TODO: a bit of code examples?