Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 35d085d

Browse filesBrowse files
[FrameworkBundle] Fix warming up routes
1 parent 2852856 commit 35d085d
Copy full SHA for 35d085d

File tree

Expand file treeCollapse file tree

1 file changed

+5
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-7
lines changed

‎Routing/Router.php

Copy file name to clipboardExpand all lines: Routing/Router.php
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getRouteCollection(): RouteCollection
6969
$this->collection->addResource(new ContainerParametersResource($this->collectedParameters));
7070

7171
try {
72-
$containerFile = ($this->paramFetcher)('kernel.cache_dir').'/'.($this->paramFetcher)('kernel.container_class').'.php';
72+
$containerFile = ($this->paramFetcher)('kernel.build_dir').'/'.($this->paramFetcher)('kernel.container_class').'.php';
7373
if (file_exists($containerFile)) {
7474
$this->collection->addResource(new FileResource($containerFile));
7575
} else {
@@ -84,14 +84,12 @@ public function getRouteCollection(): RouteCollection
8484

8585
public function warmUp(string $cacheDir, ?string $buildDir = null): array
8686
{
87-
if (!$buildDir) {
88-
return [];
87+
if (null === $currentDir = $this->getOption('cache_dir')) {
88+
return []; // skip warmUp when router doesn't use cache
8989
}
9090

91-
$currentDir = $this->getOption('cache_dir');
92-
93-
// force cache generation in build_dir
94-
$this->setOption('cache_dir', $buildDir);
91+
// force cache generation
92+
$this->setOption('cache_dir', $buildDir ?? $cacheDir);
9593
$this->getMatcher();
9694
$this->getGenerator();
9795

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.