8000 bug kernel.project_dir inconsistency between cli and web · Issue #22721 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
bug kernel.project_dir inconsistency between cli and web #22721
Closed
@tristanbes

Description

@tristanbes
Q A
Bug report? yes
Feature request? no
BC Break report? -
RFC? -
Symfony version 3.3.0-BETA1

Hello,

Following the guidelines for symfony/symfony-standard, I put in config_dev.yml

framework:
    router:
        resource: "%kernel.project_dir%/app/config/routing_dev.yml"
        strict_requirements: true
    profiler: { only_exceptions: false }

When clearing the cache via cache:clear it throws an exception because it tries to search for routing_dev.yml in wrong location

  [Symfony\Component\Config\Exception\FileLocatorFileNotFoundException]              
  The file "/var/cache/symfony/project/de_/config/routing_dev.yml" does not exist.

the path is clearly wrong, it should be, for my exemple : /srv/app). If I dump the dump($this->getParameter('kernel.project_dir') in a Controller, it returns /srv/appwhich is right.

I'm running inside a VM, so I had to change cache & logs directories for performance:

// AppKernel.php
public function getCacheDir()
{
    if (isset($_SERVER['VAGRANT']) && $_SERVER['VAGRANT']) {
        return '/var/cache/symfony/project/'.$this->environment;
    }

    return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}

public function getLogDir()
{
    if (isset($_SERVER['VAGRANT']) && $_SERVER['VAGRANT']) {
        return '/var/logs/symfony/project';
    }

    return dirname(__DIR__).'/var/logs';
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0