| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the Symfony package.
|
|
|
5 |
*
|
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
7 |
*
|
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
|
|
9 |
* file that was distributed with this source code.
|
|
|
10 |
*/
|
|
|
11 |
|
|
|
12 |
namespace Symfony\Component\Routing\DependencyInjection;
|
|
|
13 |
|
|
|
14 |
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
|
15 |
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
|
|
|
16 |
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
|
17 |
use Symfony\Component\DependencyInjection\Reference;
|
|
|
18 |
|
|
|
19 |
/**
|
|
|
20 |
* Adds tagged routing.loader services to routing.resolver service.
|
|
|
21 |
*
|
|
|
22 |
* @author Fabien Potencier <fabien@symfony.com>
|
|
|
23 |
*/
|
|
|
24 |
class RoutingResolverPass implements CompilerPassInterface
|
|
|
25 |
{
|
|
|
26 |
use PriorityTaggedServiceTrait;
|
|
|
27 |
|
|
|
28 |
public function process(ContainerBuilder $container)
|
|
|
29 |
{
|
|
|
30 |
if (false === $container->hasDefinition('routing.resolver')) {
|
|
|
31 |
return;
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
$definition = $container->getDefinition('routing.resolver');
|
|
|
35 |
|
|
|
36 |
foreach ($this->findAndSortTaggedServices('routing.loader', $container) as $id) {
|
|
|
37 |
$definition->addMethodCall('addLoader', [new Reference($id)]);
|
|
|
38 |
}
|
|
|
39 |
}
|
|
|
40 |
}
|