diff --git a/reference/configuration/kernel.rst b/reference/configuration/kernel.rst index 6f284f25690..a2b4d54da6e 100644 --- a/reference/configuration/kernel.rst +++ b/reference/configuration/kernel.rst @@ -56,6 +56,10 @@ directory and rename it to something else (e.g. ``foo``). Root Directory ~~~~~~~~~~~~~~ +.. versionadded:: 3.3 + The ``getRootDir()`` method is deprecated since Symfony 3.3. Use the new + ``getProjectDir()`` method instead. + **type**: ``string`` **default**: the directory of ``AppKernel`` This returns the root directory of your kernel. If you use the Symfony Standard @@ -77,6 +81,34 @@ To change this setting, override the } } +Project Directory +~~~~~~~~~~~~~~~~~ + +.. versionadded:: 3.3 + The ``getProjectDir()`` method was introduced in Symfony 3.3. + +**type**: ``string`` **default**: the directory of the project ``composer.json`` + +This returns the root directory of your Symfony project. It's calculated as +the directory where the main ``composer.json`` file is stored. + +If for some reason the ``composer.json`` file is not stored at the root of your +project, you can override the :method:`Symfony\\Component\\HttpKernel\\Kernel::getProjectDir` +method to return the right project directory:: + + // app/AppKernel.php + + // ... + class AppKernel extends Kernel + { + // ... + + public function getProjectDir() + { + return realpath(__DIR__.'/../'); + } + } + Cache Directory ~~~~~~~~~~~~~~~