@@ -250,32 +250,24 @@ 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::
255
254
256
- .. include :: /_includes/_annotation_loader_tip.rst.inc
257
-
258
- Some final example to use routes as annotations::
259
-
260
- \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader([$loader, 'loadClass']);
261
-
262
- use Symfony\Component\Routing\Matcher\UrlMatcher;
263
- use Symfony\Component\Routing\RequestContext;
255
+ use Doctrine\Common\Annotations\AnnotationReader;
256
+ use Symfony\Component\Config\FileLocator;
257
+ use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
258
+ use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
264
259
265
- $loader = new \Symfony\Component\Routing\Loader\ AnnotationDirectoryLoader(
266
- new \Symfony\Component\Config\ FileLocator(__DIR__.'/app/controllers/'),
267
- new \Symfony\Bundle\FrameworkBundle\Routing\ AnnotatedRouteControllerLoader(
268
- new \Doctrine\Common\Annotations\ AnnotationReader()
260
+ $loader = new AnnotationDirectoryLoader(
261
+ new FileLocator(__DIR__.'/app/controllers/'),
262
+ new AnnotatedRouteControllerLoader(
263
+ new AnnotationReader()
269
264
)
270
265
);
271
266
272
267
$routes = $loader->load(__DIR__.'/app/controllers/');
268
+ // ...
273
269
274
- $context = new RequestContext('/');
275
-
276
- $matcher = new UrlMatcher($routes, $context);
277
-
278
- $parameters = $matcher->match($_SERVER['REQUEST_URI']);
270
+ .. include :: /_includes/_annotation_loader_tip.rst.inc
279
271
280
272
The all-in-one Router
281
273
~~~~~~~~~~~~~~~~~~~~~
0 commit comments