Skip to content

Documented the new getProjectDir() method #7810

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
wants to merge 2 commits into from
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
32 changes: 32 additions & 0 deletions reference/configuration/kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not been deprecated yet, have I missed that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

``getProjectDir()`` method instead.

**type**: ``string`` **default**: the directory of ``AppKernel``

This returns the root directory of your kernel. If you use the Symfony Standard
Expand All @@ -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``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"project's"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The genitive is not common for non-living things:

We normally use the ’s with people, animals though it can also be used with places, organizations and companies (which suggest a group of people).

It is not common to use the ’s with non-living things.

Source: http://www.grammar.cl/rules/genitive-case.htm


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
~~~~~~~~~~~~~~~

Expand Down