minor #33099 [FrameworkBundle] Remove legacy route loader container (fancyweb)
This PR was merged into the 5.0-dev branch.
Discussion
----------
[FrameworkBundle] Remove legacy route loader container
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Removes deprecations from https://github.com/symfony/symfony/pull/32598
Commits
-------
8bfb3a6419
[FrameworkBundle] Remove legacy route loader container
This commit is contained in:
commit
7f1009954b
@ -18,6 +18,7 @@ CHANGELOG
|
||||
* Removed the `translator.selector` and `session.save_listener` services
|
||||
* Removed `SecurityUserValueResolver`, use `UserValueResolver` instead
|
||||
* Removed `routing.loader.service`.
|
||||
* Service route loaders must be tagged with `routing.route_loader`.
|
||||
|
||||
4.4.0
|
||||
-----
|
||||
|
@ -42,12 +42,7 @@
|
||||
|
||||
<service id="routing.loader.container" class="Symfony\Component\Routing\Loader\ContainerLoader">
|
||||
<tag name="routing.loader" />
|
||||
<argument type="service">
|
||||
<service class="Symfony\Bundle\FrameworkBundle\Routing\LegacyRouteLoaderContainer">
|
||||
<argument type="service" id="service_container" />
|
||||
<argument type="tagged_locator" tag="routing.route_loader" />
|
||||
</service>
|
||||
</argument>
|
||||
<argument type="tagged_locator" tag="routing.route_loader" />
|
||||
</service>
|
||||
|
||||
<service id="routing.loader" class="Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader" public="true">
|
||||
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Routing;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* @internal to be removed in Symfony 5.0
|
||||
*/
|
||||
class LegacyRouteLoaderContainer implements ContainerInterface
|
||||
{
|
||||
private $container;
|
||||
private $serviceLocator;
|
||||
|
||||
public function __construct(ContainerInterface $container, ContainerInterface $serviceLocator)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->serviceLocator = $serviceLocator;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
if ($this->serviceLocator->has($id)) {
|
||||
return $this->serviceLocator->get($id);
|
||||
}
|
||||
|
||||
@trigger_error(sprintf('Registering the service route loader "%s" without tagging it with the "routing.route_loader" tag is deprecated since Symfony 4.4 and will be required in Symfony 5.0.', $id), E_USER_DEPRECATED);
|
||||
|
||||
return $this->container->get($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($id)
|
||||
{
|
||||
return $this->serviceLocator->has($id) || $this->container->has($id);
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Routing;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Routing\LegacyRouteLoaderContainer;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
class LegacyRouteLoaderContainerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $serviceLocator;
|
||||
|
||||
/**
|
||||
* @var LegacyRouteLoaderContainer
|
||||
*/
|
||||
private $legacyRouteLoaderContainer;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->container = new Container();
|
||||
$this->container->set('foo', new \stdClass());
|
||||
|
||||
$this->serviceLocator = new Container();
|
||||
$this->serviceLocator->set('bar', new \stdClass());
|
||||
|
||||
$this->legacyRouteLoaderContainer = new LegacyRouteLoaderContainer($this->container, $this->serviceLocator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedDeprecation Registering the service route loader "foo" without tagging it with the "routing.route_loader" tag is deprecated since Symfony 4.4 and will be required in Symfony 5.0.
|
||||
*/
|
||||
public function testGet()
|
||||
{
|
||||
$this->assertSame($this->container->get('foo'), $this->legacyRouteLoaderContainer->get('foo'));
|
||||
$this->assertSame($this->serviceLocator->get('bar'), $this->legacyRouteLoaderContainer->get('bar'));
|
||||
}
|
||||
|
||||
public function testHas()
|
||||
{
|
||||
$this->assertTrue($this->legacyRouteLoaderContainer->has('foo'));
|
||||
$this->assertTrue($this->legacyRouteLoaderContainer->has('bar'));
|
||||
$this->assertFalse($this->legacyRouteLoaderContainer->has('ccc'));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user