-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "project's"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The genitive is not common for non-living things:
|
||
|
||
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 | ||
~~~~~~~~~~~~~~~ | ||
|
||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is: https://github.com/symfony/symfony/pull/22315/files#diff-776debe25c0a772039d45b8d692c9dbfR8