Skip to content

Commit 56e4408

Browse files
implement ServiceSubscriberInterface where applicable
1 parent e22fcfe commit 56e4408

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

Resources/config/session.xml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,8 @@
5353

5454
<service id="session_listener" class="Symfony\Component\HttpKernel\EventListener\SessionListener">
5555
<tag name="kernel.event_subscriber" />
56-
<argument type="service">
57-
<service class="Symfony\Component\DependencyInjection\ServiceLocator">
58-
<tag name="container.service_locator" />
59-
<argument type="collection">
60-
<argument key="session" type="service" id="session" on-invalid="ignore" />
61-
</argument>
62-
</service>
63-
</argument>
56+
<tag name="container.service_subscriber" id="session" />
57+
<argument type="service" id="container" />
6458
</service>
6559

6660
<service id="session.save_listener" class="Symfony\Component\HttpKernel\EventListener\SaveSessionListener">

Resources/config/test.xml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,8 @@
2222

2323
<service id="test.session.listener" class="Symfony\Component\HttpKernel\EventListener\TestSessionListener">
2424
<tag name="kernel.event_subscriber" />
25-
<argument type="service">
26-
<service class="Symfony\Component\DependencyInjection\ServiceLocator">
27-
<tag name="container.service_locator" />
28-
<argument type="collection">
29-
<argument key="session" type="service" id="session" on-invalid="ignore" />
30-
</argument>
31-
</service>
32-
</argument>
25+
<tag name="container.service_subscriber" id="session" />
26+
<argument type="service" id="container" />
3327
</service>
3428
</services>
3529
</container>

Routing/Router.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Routing;
1313

14+
use Symfony\Component\Config\Loader\LoaderInterface;
1415
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
16+
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
1517
use Symfony\Component\Routing\Router as BaseRouter;
1618
use Symfony\Component\Routing\RequestContext;
1719
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -25,7 +27,7 @@
2527
*
2628
* @author Fabien Potencier <[email protected]>
2729
*/
28-
class Router extends BaseRouter implements WarmableInterface
30+
class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberInterface
2931
{
3032
private $container;
3133
private $collectedParameters = array();
@@ -173,4 +175,14 @@ private function resolve($value)
173175

174176
return str_replace('%%', '%', $escapedValue);
175177
}
178+
179+
/**
180+
* {@inheritdoc}
181+
*/
182+
public static function getSubscribedServices()
183+
{
184+
return array(
185+
'routing.loader' => LoaderInterface::class,
186+
);
187+
}
176188
}

0 commit comments

Comments
 (0)