Skip to content

Commit fc952d2

Browse files
committed
[Routing] Route loader service tag
1 parent 0cba12e commit fc952d2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

routing/custom_route_loader.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ and configure the service and method to call:
9898
9999
# config/routes.yaml
100100
admin_routes:
101-
resource: 'admin_route_loader:loadRoutes'
101+
resource: 'admin_route_loader::loadRoutes'
102102
type: service
103103
104104
.. code-block:: xml
@@ -110,7 +110,7 @@ and configure the service and method to call:
110110
xsi:schemaLocation="http://symfony.com/schema/routing
111111
https://symfony.com/schema/routing/routing-1.0.xsd">
112112
113-
<import resource="admin_route_loader:loadRoutes" type="service"/>
113+
<import resource="admin_route_loader::loadRoutes" type="service"/>
114114
</routes>
115115
116116
.. code-block:: php
@@ -119,14 +119,20 @@ and configure the service and method to call:
119119
namespace Symfony\Component\Routing\Loader\Configurator;
120120
121121
return function (RoutingConfigurator $routes) {
122-
$routes->import('admin_route_loader:loadRoutes', 'service');
122+
$routes->import('admin_route_loader::loadRoutes', 'service');
123123
};
124124
125125
In this example, the routes are loaded by calling the ``loadRoutes()`` method
126126
of the service whose ID is ``admin_route_loader``. Your service doesn't have to
127127
extend or implement any special class, but the called method must return a
128128
:class:`Symfony\\Component\\Routing\\RouteCollection` object.
129129

130+
If you're using :ref:`autoconfigure <services-autoconfigure>`, your service should
131+
implement the `ServiceRouterLoaderInterface` interface to be tagged automatically by
132+
Symfony!
133+
134+
If you are **not using autoconfigure**, tag it manually with ``routing.route_loader``.
135+
130136
.. note::
131137

132138
The routes defined using service route loaders will be automatically

0 commit comments

Comments
 (0)