Skip to content

Commit 68414b1

Browse files
committed
Merge branch '4.3' into 4.4
* 4.3: Sort imports alphabetically cleaning up some use statements, etc Update routing.rst
2 parents 2c2e00c + e8d6eb4 commit 68414b1

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

components/routing.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,22 @@ Annotation Routing Loaders
250250
Last 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::
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+
// ...
255269

256270
.. include:: /_includes/_annotation_loader_tip.rst.inc
257271

0 commit comments

Comments
 (0)