File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -250,8 +250,22 @@ Annotation Routing Loaders
250
250
Last but not least there are
251
251
:class: `Symfony\\ Component\\ Routing\\ Loader\\ AnnotationDirectoryLoader ` and
252
252
:class: `Symfony\\ Component\\ Routing\\ Loader\\ AnnotationFileLoader ` to load
253
- route definitions from class annotations. The specific details are left
254
- out here.
253
+ route definitions from class annotations::
254
+
255
+ use Doctrine\Common\Annotations\AnnotationReader;
256
+ use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
257
+ use Symfony\Component\Config\FileLocator;
258
+ use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
259
+
260
+ $loader = new AnnotationDirectoryLoader(
261
+ new FileLocator(__DIR__.'/app/controllers/'),
262
+ new AnnotatedRouteControllerLoader(
263
+ new AnnotationReader()
264
+ )
265
+ );
266
+
267
+ $routes = $loader->load(__DIR__.'/app/controllers/');
268
+ // ...
255
269
256
270
.. include :: /_includes/_annotation_loader_tip.rst.inc
257
271
You can’t perform that action at this time.
0 commit comments