@@ -250,32 +250,24 @@ Annotation Routing Loaders
250250Last but not least there are
251251:class: `Symfony\\ Component\\ Routing\\ Loader\\ AnnotationDirectoryLoader ` and
252252: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::
255254
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;
264259
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()
269264 )
270265 );
271266
272267 $routes = $loader->load(__DIR__.'/app/controllers/');
268+ // ...
273269
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
279271
280272The all-in-one Router
281273~~~~~~~~~~~~~~~~~~~~~
0 commit comments