Skip to content

removed deprecated root dir #11072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 3 additions & 36 deletions reference/configuration/kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Configuration

* `Charset`_
* `Kernel Name`_
* `Root Directory`_
* `Project Directory`_
* `Cache Directory`_
* `Log Directory`_

Expand Down Expand Up @@ -53,42 +53,9 @@ generation of cache files. If you have an application with multiple kernels,
the easiest way to make each have a unique name is to duplicate the ``app``
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
edition, the root directory refers to the ``app`` directory.

To change this setting, override the
:method:`Symfony\\Component\\HttpKernel\\Kernel::getRootDir` method::

// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
// ...

public function getRootDir()
{
return realpath(parent::getRootDir().'/../');
}
}

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
Expand All @@ -114,7 +81,7 @@ method to return the right project directory::
Cache Directory
~~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``$this->rootDir/cache/$this->environment``
**type**: ``string`` **default**: ``$this->projectDir/cache/$this->environment``

This returns the path to the cache directory. To change it, override the
:method:`Symfony\\Component\\HttpKernel\\Kernel::getCacheDir` method. Read
Expand All @@ -123,7 +90,7 @@ This returns the path to the cache directory. To change it, override the
Log Directory
~~~~~~~~~~~~~

**type**: ``string`` **default**: ``$this->rootDir/logs``
**type**: ``string`` **default**: ``$this->projectDir/logs``

This returns the path to the log directory. To change it, override the
:method:`Symfony\\Component\\HttpKernel\\Kernel::getLogDir` method. Read
Expand Down