Skip to content

[Reference] Document AppKernel config settings #2217

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

Merged
merged 1 commit into from
Mar 4, 2013
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions cookbook/configuration/override_dir_structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ directory structure is:
app.php
...

.. _override-cache-dir:

Override the ``cache`` directory
--------------------------------

Expand Down Expand Up @@ -53,6 +55,8 @@ the location of the cache directory to ``app/{environment}/cache``.
its own cached config files, and so each needs its own directory to store
those cache files.

.. _override-logs-dir:

Override the ``logs`` directory
-------------------------------

Expand Down
68 changes: 68 additions & 0 deletions reference/configuration/kernel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.. index::
single: Configuration reference; Kernel class

Configuration in the ``AppKernel``
==================================

Some configuration can be done in the ``AppKernel`` class (which is located in
``app/AppKernel.php``. You can do this by overriding the method of the
:class:`Symfony\\Component\\HttpKernel\\Kernel` class, which is extended by
the ``AppKernel`` class.

Configuration
-------------

* `kernel name`_
* `root directory`_
* `cache directory`_
* `log directory`_

kernel name
~~~~~~~~~~~

**type**: ``string`` **default**: ``$this->name``

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

root directory
~~~~~~~~~~~~~~

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

This returns the root directory of you Symfony2 application. 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().'/../');
}
}

cache directory
~~~~~~~~~~~~~~~

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

This returns the cache directory. You need to override the
:method:`Symfony\\Component\\HttpKernel\\Kernel::getCacheDir` method. Read
":ref:`override-cache-dir`" for more information.

log directory
~~~~~~~~~~~~~

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

This returns the log directory. You need to override the
:method:`Symfony\\Component\\HttpKernel\\Kernel::getLogDir` method. Read
":ref:`override-logs-dir`" for more information.
1 change: 1 addition & 0 deletions reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Reference Documents
configuration/twig
configuration/monolog
configuration/web_profiler
configuration/kernel

forms/types
forms/twig_reference
Expand Down
4 changes: 3 additions & 1 deletion reference/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
* :doc:`doctrine </reference/configuration/doctrine>`
* :doc:`security </reference/configuration/security>`
* :doc:`assetic </reference/configuration/assetic>`
* :doc:`swiftmailer </reference/configuration/swiftmailer>`
* :doc:`swiftMailer </reference/configuration/swiftmailer>`
* :doc:`twig </reference/configuration/twig>`
* :doc:`monolog </reference/configuration/monolog>`
* :doc:`web_profiler </reference/configuration/web_profiler>`

* :doc:`Configuration in the Kernel </reference/configuration/kernel>`

* **Forms and Validation**

* :doc:`Form Field Type Reference</reference/forms/types>`
Expand Down