@@ -98,7 +98,7 @@ and configure the service and method to call:
98
98
99
99
# config/routes.yaml
100
100
admin_routes :
101
- resource : ' admin_route_loader:loadRoutes'
101
+ resource : ' admin_route_loader:: loadRoutes'
102
102
type : service
103
103
104
104
.. code-block :: xml
@@ -110,7 +110,7 @@ and configure the service and method to call:
110
110
xsi : schemaLocation =" http://symfony.com/schema/routing
111
111
https://symfony.com/schema/routing/routing-1.0.xsd" >
112
112
113
- <import resource =" admin_route_loader:loadRoutes" type =" service" />
113
+ <import resource =" admin_route_loader:: loadRoutes" type =" service" />
114
114
</routes >
115
115
116
116
.. code-block :: php
@@ -119,7 +119,7 @@ and configure the service and method to call:
119
119
namespace Symfony\Component\Routing\Loader\Configurator;
120
120
121
121
return function (RoutingConfigurator $routes) {
122
- $routes->import('admin_route_loader:loadRoutes', 'service');
122
+ $routes->import('admin_route_loader:: loadRoutes', 'service');
123
123
};
124
124
125
125
In this example, the routes are loaded by calling the ``loadRoutes() `` method
@@ -133,6 +133,15 @@ extend or implement any special class, but the called method must return a
133
133
cached by the framework. So whenever your service should load new routes,
134
134
don't forget to clear the cache.
135
135
136
+ .. tip ::
137
+
138
+ If your service is invokable, you don't need to precise the method to use.
139
+
140
+ .. versionadded :: 4.3
141
+
142
+ The support of the ``__invoke() `` method to create invokable route loader
143
+ services was introduced in Symfony 4.3.
144
+
136
145
Creating a custom Loader
137
146
------------------------
138
147
0 commit comments