diff --git a/cookbook/configuration/override_dir_structure.rst b/cookbook/configuration/override_dir_structure.rst index 804d94761a5..212f8d3845f 100644 --- a/cookbook/configuration/override_dir_structure.rst +++ b/cookbook/configuration/override_dir_structure.rst @@ -23,6 +23,8 @@ directory structure is: app.php ... +.. _override-cache-dir: + Override the ``cache`` directory -------------------------------- @@ -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 ------------------------------- diff --git a/reference/configuration/kernel.rst b/reference/configuration/kernel.rst new file mode 100644 index 00000000000..7307c32c443 --- /dev/null +++ b/reference/configuration/kernel.rst @@ -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. diff --git a/reference/index.rst b/reference/index.rst index 6895079015e..b1cafff5ad7 100755 --- a/reference/index.rst +++ b/reference/index.rst @@ -12,6 +12,7 @@ Reference Documents configuration/twig configuration/monolog configuration/web_profiler + configuration/kernel forms/types forms/twig_reference diff --git a/reference/map.rst.inc b/reference/map.rst.inc index 9801e7991b8..297e9aa9720 100755 --- a/reference/map.rst.inc +++ b/reference/map.rst.inc @@ -9,11 +9,13 @@ * :doc:`doctrine ` * :doc:`security ` * :doc:`assetic ` - * :doc:`swiftmailer ` + * :doc:`swiftMailer ` * :doc:`twig ` * :doc:`monolog ` * :doc:`web_profiler ` +* :doc:`Configuration in the Kernel ` + * **Forms and Validation** * :doc:`Form Field Type Reference`