File tree 3 files changed +13
-7
lines changed
src/Symfony/Bundle/TwigBundle
DependencyInjection/Compiler 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,13 @@ public function process(ContainerBuilder $container)
64
64
$ container ->getDefinition ('twig.extension.debug ' )->addTag ('twig.extension ' );
65
65
}
66
66
67
+ $ composerRootDir = $ this ->getComposerRootDir ($ container ->getParameter ('kernel.root_dir ' ));
68
+ $ loader = $ container ->getDefinition ('twig.loader.filesystem ' );
69
+ $ loader ->replaceArgument (2 , $ composerRootDir );
70
+
67
71
if (!$ container ->has ('templating ' )) {
68
72
$ loader = $ container ->getDefinition ('twig.loader.native_filesystem ' );
69
- $ loader ->replaceArgument (1 , $ this -> getComposerRootDir ( $ container -> getParameter ( ' kernel.root_dir ' )) );
73
+ $ loader ->replaceArgument (1 , $ composerRootDir );
70
74
$ loader ->addTag ('twig.loader ' );
71
75
$ loader ->setMethodCalls ($ container ->getDefinition ('twig.loader.filesystem ' )->getMethodCalls ());
72
76
Original file line number Diff line number Diff line change @@ -29,12 +29,13 @@ class FilesystemLoader extends \Twig_Loader_Filesystem
29
29
/**
30
30
* Constructor.
31
31
*
32
- * @param FileLocatorInterface $locator A FileLocatorInterface instance
33
- * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance
32
+ * @param FileLocatorInterface $locator A FileLocatorInterface instance
33
+ * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance
34
+ * @param string|null $rootPath The root path common to all relative paths (null for getcwd())
34
35
*/
35
- public function __construct (FileLocatorInterface $ locator , TemplateNameParserInterface $ parser )
36
+ public function __construct (FileLocatorInterface $ locator , TemplateNameParserInterface $ parser, $ rootPath = null )
36
37
{
37
- parent ::__construct (array ());
38
+ parent ::__construct (array (), $ rootPath );
38
39
39
40
$ this ->locator = $ locator ;
40
41
$ this ->parser = $ parser ;
Original file line number Diff line number Diff line change 46
46
47
47
<service id =" twig.loader.native_filesystem" class =" Twig_Loader_Filesystem" public =" false" >
48
48
<argument type =" collection" /> <!-- paths -->
49
- <argument ></ argument > <!-- project's root dir -->
49
+ <argument / > <!-- project's root dir -->
50
50
</service >
51
51
52
52
<service id =" twig.loader.filesystem" class =" Symfony\Bundle\TwigBundle\Loader\FilesystemLoader" public =" false" >
53
53
<argument type =" service" id =" templating.locator" />
54
54
<argument type =" service" id =" templating.name_parser" />
55
+ <argument /> <!-- project's root dir -->
55
56
<tag name =" twig.loader" />
56
57
</service >
57
58
87
88
88
89
<service id =" twig.extension.code" class =" Symfony\Bridge\Twig\Extension\CodeExtension" public =" false" >
89
90
<tag name =" twig.extension" />
90
- <argument type =" service" id =" debug.file_link_formatter" ></ argument >
91
+ <argument type =" service" id =" debug.file_link_formatter" / >
91
92
<argument >%kernel.root_dir%</argument >
92
93
<argument >%kernel.charset%</argument >
93
94
</service >
You can’t perform that action at this time.
0 commit comments