Skip to content

Commit

Permalink
[FrameworkBundle] Fix Router Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Pédelagrabe authored and nicolas-grekas committed Mar 19, 2020
1 parent efb4a7f commit c6ace13
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
Expand Up @@ -15,6 +15,8 @@
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface;
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\ContainerInterface as SymfonyContainerInterface;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
Expand Down Expand Up @@ -71,6 +73,16 @@ public function getRouteCollection()
$this->collection = $this->container->get('routing.loader')->load($this->resource, $this->options['resource_type']);
$this->resolveParameters($this->collection);
$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;
Expand Down

0 comments on commit c6ace13

Please sign in to comment.