Skip to content

Commit f0ef822

Browse files
Guillaume Pédelagrabenicolas-grekas
authored andcommitted
[FrameworkBundle] Fix Router Cache
1 parent 8eca121 commit f0ef822

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Routing/Router.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Psr\Log\LoggerInterface;
1616
use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface;
1717
use Symfony\Component\Config\Loader\LoaderInterface;
18+
use Symfony\Component\Config\Resource\FileExistenceResource;
19+
use Symfony\Component\Config\Resource\FileResource;
1820
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
1921
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
2022
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
@@ -71,6 +73,16 @@ public function getRouteCollection()
7173
$this->collection = $this->container->get('routing.loader')->load($this->resource, $this->options['resource_type']);
7274
$this->resolveParameters($this->collection);
7375
$this->collection->addResource(new ContainerParametersResource($this->collectedParameters));
76+
77+
try {
78+
$containerFile = ($this->paramFetcher)('kernel.cache_dir').'/'.($this->paramFetcher)('kernel.container_class').'.php';
79+
if (file_exists($containerFile)) {
80+
$this->collection->addResource(new FileResource($containerFile));
81+
} else {
82+
$this->collection->addResource(new FileExistenceResource($containerFile));
83+
}
84+
} catch (ParameterNotFoundException $exception) {
85+
}
7486
}
7587

7688
return $this->collection;

0 commit comments

Comments
 (0)