Use $this->getProjectDir() instead of dirname(__DIR__)

This commit is contained in:
Jan Rosier
2017-11-10 13:40:49 +01:00
parent 5f0d5069b2
commit 2bb4ff005c
+5 -5
View File
@@ -16,17 +16,17 @@ class Kernel extends BaseKernel
public function getCacheDir()
{
return dirname(__DIR__).'/var/cache/'.$this->environment;
return $this->getProjectDir().'/var/cache/'.$this->environment;
}
public function getLogDir()
{
return dirname(__DIR__).'/var/log';
return $this->getProjectDir().'/var/log';
}
public function registerBundles()
{
$contents = require dirname(__DIR__).'/config/bundles.php';
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if (isset($envs['all']) || isset($envs[$this->environment])) {
yield new $class();
@@ -37,7 +37,7 @@ class Kernel extends BaseKernel
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
$container->setParameter('container.autowiring.strict_mode', true);
$confDir = dirname(__DIR__).'/config';
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob');
if (is_dir($confDir.'/packages/'.$this->environment)) {
$loader->load($confDir.'/packages/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
@@ -48,7 +48,7 @@ class Kernel extends BaseKernel
protected function configureRoutes(RouteCollectionBuilder $routes)
{
$confDir = dirname(__DIR__).'/config';
$confDir = $this->getProjectDir().'/config';
if (is_dir($confDir.'/routes/')) {
$routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob');
}