-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Labels
Description
Because dashes are being replaced with underscores in yaml config keys, it is sometimes impossible to define a new twig namespace, for example
twig:
#...
paths:
/a-directory-with-dashes: myfirstnamespace
%kernel.root_dir%/../another-directory-with-dashes: mysecondnamespace
causes an exception
[Twig_Error_Loader]
The "/a_directory_with_dashes" directory does not exist.
The same exception will fire for the second row if the first one gets removed despite that %kernel.root_dir% successfully gets replaced with real value.
Thus, the directories containing dashes can only be declared as parts of the default __main__
namespace like this:
twig:
#...
paths: [/a-directory-with-dashes, %kernel.root_dir%/../another-directory-with-dashes]
so the situation is definitely a bug.
A solution could be found in swapping keys and values in the config or in making the structure of paths
more complicated, e.g.:
twig:
#...
paths:
- {path: /a-directory-with-dashes, namespace: myfirstnamespace}
- {path: %kernel.root_dir%/../another-directory-with-dashes, namespace: mysecondnamespace}