Skip to content

Commit

Permalink
Updated directory structures
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Nov 28, 2015
1 parent df20095 commit f2be12a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
12 changes: 9 additions & 3 deletions cookbook/configuration/configuration_organization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ default Symfony Standard Edition follow this structure:

.. code-block:: text
<your-project>/
your-project/
├─ app/
│ └─ config/
│ ├─ config.yml
Expand All @@ -47,6 +47,8 @@ default Symfony Standard Edition follow this structure:
│ ├─ routing_dev.yml
│ └─ security.yml
├─ src/
├─ tests/
├─ var/
├─ vendor/
└─ web/
Expand All @@ -65,7 +67,7 @@ name as the environment:

.. code-block:: text
<your-project>/
your-project/
├─ app/
│ └─ config/
│ ├─ common/
Expand All @@ -84,6 +86,8 @@ name as the environment:
│ ├─ routing.yml
│ └─ security.yml
├─ src/
├─ tests/
├─ var/
├─ vendor/
└─ web/
Expand Down Expand Up @@ -161,7 +165,7 @@ and several files to define all application services:

.. code-block:: text
<your-project>/
your-project/
├─ app/
│ └─ config/
│ ├─ bundles/
Expand All @@ -183,6 +187,8 @@ and several files to define all application services:
│ ├─ ...
│ └─ security.yml
├─ src/
├─ tests/
├─ var/
├─ vendor/
└─ web/
Expand Down
2 changes: 1 addition & 1 deletion cookbook/configuration/environments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ However, each environment caches its own set of files:

.. code-block:: text
<your-project>/
your-project/
├─ var/
│ ├─ cache/
│ │ ├─ dev/ # cache directory for the *dev* environment
Expand Down
35 changes: 20 additions & 15 deletions cookbook/configuration/override_dir_structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ directory structure is:
your-project/
├─ app/
│ ├─ cache/
│ ├─ config/
│ ├─ logs/
│ └─ ...
├─ src/
│ └─ ...
├─ tests/
│ └─ ...
├─ var/
│ ├─ cache/
│ ├─ logs/
│ └─ ...
├─ vendor/
│ └─ ...
└─ web/
Expand All @@ -41,13 +45,13 @@ in the ``AppKernel`` class of you application::

public function getCacheDir()
{
return $this->rootDir.'/'.$this->environment.'/cache';
return dirname(__DIR__).'/var/'.$this->environment.'/cache';
}
}

``$this->rootDir`` is the absolute path to the ``app`` directory and ``$this->environment``
is the current environment (i.e. ``dev``). In this case you have changed
the location of the cache directory to ``app/{environment}/cache``.
In this code, ``$this->environment`` is the current environment (i.e. ``dev``).
In this case you have changed the location of the cache directory to
``var/{environment}/cache``.

.. caution::

Expand All @@ -74,34 +78,34 @@ method::

public function getLogDir()
{
return $this->rootDir.'/'.$this->environment.'/logs';
return dirname(__DIR__).'/var/'.$this->environment.'/logs';
}
}

Here you have changed the location of the directory to ``app/{environment}/logs``.
Here you have changed the location of the directory to ``var/{environment}/logs``.

.. _override-web-dir:

Override the ``web`` Directory
------------------------------

If you need to rename or move your ``web`` directory, the only thing you
need to guarantee is that the path to the ``app`` directory is still correct
need to guarantee is that the path to the ``var`` directory is still correct
in your ``app.php`` and ``app_dev.php`` front controllers. If you simply
renamed the directory, you're fine. But if you moved it in some way, you
may need to modify these paths inside those files::

require_once __DIR__.'/../Symfony/var/bootstrap.php.cache';
require_once __DIR__.'/../path/to/var/bootstrap.php.cache';

You also need to change the ``extra.symfony-web-dir`` option in the ``composer.json``
file:
You also need to change the ``extra.symfony-web-dir`` option in the
``composer.json`` file:

.. code-block:: javascript
.. code-block:: json
{
...
"...": "...",
"extra": {
...
"...": "...",
"symfony-web-dir": "my_new_web_dir"
}
}
Expand Down Expand Up @@ -178,6 +182,7 @@ The change in the ``composer.json`` will look like this:
Then, update the path to the ``autoload.php`` file in ``app/autoload.php``::

// app/autoload.php

// ...
$loader = require '/some/dir/vendor/autoload.php';

Expand Down

0 comments on commit f2be12a

Please sign in to comment.