File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ directory and rename it to something else (e.g. ``foo``).
5656Root Directory
5757~~~~~~~~~~~~~~
5858
59+ .. versionadded :: 3.3
60+ The ``getRootDir() `` method is deprecated since Symfony 3.3. Use the new
61+ ``getProjectDir() `` method instead.
62+
5963**type **: ``string `` **default **: the directory of ``AppKernel ``
6064
6165This returns the root directory of your kernel. If you use the Symfony Standard
@@ -77,6 +81,34 @@ To change this setting, override the
7781 }
7882 }
7983
84+ Project Directory
85+ ~~~~~~~~~~~~~~~~~
86+
87+ .. versionadded :: 3.3
88+ The ``getProjectDir() `` method was introduced in Symfony 3.3.
89+
90+ **type **: ``string `` **default **: the directory of the project ``composer.json ``
91+
92+ This returns the root directory of your Symfony project. It's calculated as
93+ the directory where the main ``composer.json `` file is stored.
94+
95+ If for some reason the ``composer.json `` file is not stored at the root of your
96+ project, you can override the :method: `Symfony\\ Component\\ HttpKernel\\ Kernel::getProjectDir `
97+ method to return the right project directory::
98+
99+ // app/AppKernel.php
100+
101+ // ...
102+ class AppKernel extends Kernel
103+ {
104+ // ...
105+
106+ public function getProjectDir()
107+ {
108+ return realpath(__DIR__.'/../');
109+ }
110+ }
111+
80112Cache Directory
81113~~~~~~~~~~~~~~~
82114
You can’t perform that action at this time.
0 commit comments