Skip to content

Commit 725d107

Browse files
committed
Merge branch '2.0' into 2.1
2 parents a4ea400 + 672ded5 commit 725d107

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

cookbook/configuration/override_dir_structure.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ directory structure is:
2323
app.php
2424
...
2525
26+
.. _override-cache-dir:
27+
2628
Override the ``cache`` directory
2729
--------------------------------
2830

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

58+
.. _override-logs-dir:
59+
5660
Override the ``logs`` directory
5761
-------------------------------
5862

reference/configuration/kernel.rst

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
.. index::
2+
single: Configuration reference; Kernel class
3+
4+
Configuring in the Kernel (e.g. AppKernel)
5+
==========================================
6+
7+
Some configuration can be done on the kernel class itself (usually called
8+
``app/AppKernel.php``). You can do this by overriding specific methods in
9+
the parent :class:`Symfony\\Component\\HttpKernel\\Kernel` class.
10+
11+
Configuration
12+
-------------
13+
14+
* `Kernel Name`_
15+
* `Root Directory`_
16+
* `Cache Directory`_
17+
* `Log Directory`_
18+
19+
Kernel Name
20+
~~~~~~~~~~~
21+
22+
**type**: ``string`` **default**: ``app`` (i.e. the directory name holding the kernel class)
23+
24+
To change this setting, override the :method:`Symfony\\Component\\HttpKernel\\Kernel::getName`
25+
method. Alternatively, move your kernel into a different directory. For example,
26+
if you moved the kernel into a ``foo`` directory (instead of ``app``), the
27+
kernel name will be ``foo``.
28+
29+
The name of the kernel isn't usually directly important - it's used in the
30+
generation of cache files. If you have an application with multiple kernels,
31+
the easiest way to make each have a unique name is to duplicate the ``app``
32+
directory and rename it to something else (e.g. ``foo``).
33+
34+
Root Directory
35+
~~~~~~~~~~~~~~
36+
37+
**type**: ``string`` **default**: the directory of ``AppKernel``
38+
39+
This returns the root directory of your kernel. If you use the Symfony Standard
40+
edition, the root directory refers to the ``app`` directory.
41+
42+
To change this setting, override the
43+
:method:`Symfony\\Component\\HttpKernel\\Kernel::getRootDir` method::
44+
45+
// app/AppKernel.php
46+
47+
// ...
48+
class AppKernel extends Kernel
49+
{
50+
// ...
51+
52+
public function getRootDir()
53+
{
54+
return realpath(parent::getRootDir().'/../');
55+
}
56+
}
57+
58+
Cache Directory
59+
~~~~~~~~~~~~~~~
60+
61+
**type**: ``string`` **default**: ``$this->rootDir/cache/$this->environment``
62+
63+
This returns the path to the cache directory. To change it, override the
64+
:method:`Symfony\\Component\\HttpKernel\\Kernel::getCacheDir` method. Read
65+
":ref:`override-cache-dir`" for more information.
66+
67+
Log Directory
68+
~~~~~~~~~~~~~
69+
70+
**type**: ``string`` **default**: ``$this->rootDir/logs``
71+
72+
This returns the path to the log directory. To change it, override the
73+
:method:`Symfony\\Component\\HttpKernel\\Kernel::getLogDir` method. Read
74+
":ref:`override-logs-dir`" for more information.

reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Reference Documents
1212
configuration/twig
1313
configuration/monolog
1414
configuration/web_profiler
15+
configuration/kernel
1516

1617
forms/types
1718
forms/twig_reference

reference/map.rst.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* :doc:`monolog </reference/configuration/monolog>`
1515
* :doc:`web_profiler </reference/configuration/web_profiler>`
1616

17+
* :doc:`Configuring the Kernel (e.g. AppKernel) </reference/configuration/kernel>`
18+
1719
* **Forms and Validation**
1820

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

0 commit comments

Comments
 (0)