Description
The FileLocator currently defines a global directory where resources can be loaded from. %kernel.root_dir%/Resources
and %kernel.root_dir%
are the fallback directories for any resources. So in SF 3 this means
app/Resources
can be used to overwrite resources from Bundlesapp/
can be used to load any resource if they are not found relative to the current directory the source is loaded from
But that behavior has never officially been unsed in a SF 2/3 symfony-standard or SF 4 flex kernel. They are either loaded relative to the current dir or via glob pattern, not by a global fallback.
Overwriting bundle resources should also not be done like this since forever. See https://symfony.com/doc/current/bundles/override.html
It should be done with compiler passes for services or twig namespace (which uses the /templates/ dir) for templates or translation domains for translations.
We want to remove the %kernel.root_dir%
. If we change this to use project_dir, it means the fallback dir is not app/Resources
as in SF 3 or src/Resources
in SF 4, but Resources/
directly in SF 5. Whatever we put here, it does not make sense and is not documented anywhere.
I suggest to deprecate this global fallback dir in SF 4.4 and remove it in 5. Then this problem is gone.
See #31672 (comment)