[FrameworkBundle] Fix Router Cache
This commit is contained in:
parent
efb4a7f0bc
commit
c6ace13e34
@ -15,6 +15,8 @@ use Psr\Container\ContainerInterface;
|
|||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface;
|
use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
|
use Symfony\Component\Config\Resource\FileExistenceResource;
|
||||||
|
use Symfony\Component\Config\Resource\FileResource;
|
||||||
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
|
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
|
||||||
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
|
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
|
||||||
@ -71,6 +73,16 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
|||||||
$this->collection = $this->container->get('routing.loader')->load($this->resource, $this->options['resource_type']);
|
$this->collection = $this->container->get('routing.loader')->load($this->resource, $this->options['resource_type']);
|
||||||
$this->resolveParameters($this->collection);
|
$this->resolveParameters($this->collection);
|
||||||
$this->collection->addResource(new ContainerParametersResource($this->collectedParameters));
|
$this->collection->addResource(new ContainerParametersResource($this->collectedParameters));
|
||||||
|
|
||||||
|
try {
|
||||||
|
$containerFile = ($this->paramFetcher)('kernel.cache_dir').'/'.($this->paramFetcher)('kernel.container_class').'.php';
|
||||||
|
if (file_exists($containerFile)) {
|
||||||
|
$this->collection->addResource(new FileResource($containerFile));
|
||||||
|
} else {
|
||||||
|
$this->collection->addResource(new FileExistenceResource($containerFile));
|
||||||
|
}
|
||||||
|
} catch (ParameterNotFoundException $exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->collection;
|
return $this->collection;
|
||||||
|
Reference in New Issue
Block a user