8000 [FrameworkBundle] Only override getProjectDir if it exists in the kernel by aschempp · Pull Request #22921 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Only override getProjectDir if it exists in the kernel #22921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,27 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
*/
protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir)
{
$projectDir = '';
$cacheDir = var_export($warmupDir, true);
$rootDir = var_export(realpath($parent->getRootDir()), true);
$projectDir = var_export(realpath($parent->getProjectDir()), true);
$logDir = var_export(realpath($parent->getLogDir()), true);
// the temp kernel class name must have the same length than the real one
// to avoid the many problems in serialized resources files
$class = substr($parentClass, 0, -1).'_';
// the temp container class must be changed too
$containerClass = var_export(substr(get_class($parent->getContainer()), 0, -1).'_', true);

if (method_exists($parent, 'getProjectDir')) {
$projectDir = var_export(realpath($parent->getProjectDir()), true);
$projectDir = <<<EOF
public function getProjectDir()
{
return $projectDir;
}

EOF;
};

$code = <<<EOF
<?php

Expand All @@ -225,11 +237,7 @@ public function getRootDir()
return $rootDir;
}

public function getProjectDir()
{
return $projectDir;
}

$projectDir
public function getLogDir()
{
return $logDir;
Expand Down
0