@@ -12,12 +12,16 @@ directory structure is:
1212
1313 your-project/
1414 ├─ app/
15- │ ├─ cache/
1615 │ ├─ config/
17- │ ├─ logs/
1816 │ └─ ...
1917 ├─ src/
2018 │ └─ ...
19+ ├─ tests/
20+ │ └─ ...
21+ ├─ var/
22+ │ ├─ cache/
23+ │ ├─ logs/
24+ │ └─ ...
2125 ├─ vendor/
2226 │ └─ ...
2327 └─ web/
@@ -41,13 +45,13 @@ in the ``AppKernel`` class of you application::
4145
4246 public function getCacheDir()
4347 {
44- return $this->rootDir.' /'.$this->environment.'/cache';
48+ return dirname(__DIR__).'/var /'.$this->environment.'/cache';
4549 }
4650 }
4751
48- ``$this->rootDir `` is the absolute path to the `` app `` directory and `` $this->environment ``
49- is the current environment (i.e. `` dev ``). In this case you have changed
50- the location of the cache directory to `` app /{environment}/cache ``.
52+ In this code, ``$this->environment `` is the current environment (i.e. `` dev ``).
53+ In this case you have changed the location of the cache directory to
54+ `` var /{environment}/cache ``.
5155
5256.. caution ::
5357
@@ -74,34 +78,34 @@ method::
7478
7579 public function getLogDir()
7680 {
77- return $this->rootDir.' /'.$this->environment.'/logs';
81+ return dirname(__DIR__).'/var /'.$this->environment.'/logs';
7882 }
7983 }
8084
81- Here you have changed the location of the directory to ``app /{environment}/logs ``.
85+ Here you have changed the location of the directory to ``var /{environment}/logs ``.
8286
8387.. _override-web-dir :
8488
8589Override the ``web `` Directory
8690------------------------------
8791
8892If you need to rename or move your ``web `` directory, the only thing you
89- need to guarantee is that the path to the ``app `` directory is still correct
93+ need to guarantee is that the path to the ``var `` directory is still correct
9094in your ``app.php `` and ``app_dev.php `` front controllers. If you simply
9195renamed the directory, you're fine. But if you moved it in some way, you
9296may need to modify these paths inside those files::
9397
94- require_once __DIR__.'/../Symfony /var/bootstrap.php.cache';
98+ require_once __DIR__.'/../path/to /var/bootstrap.php.cache';
9599
96- You also need to change the ``extra.symfony-web-dir `` option in the `` composer.json ``
97- file:
100+ You also need to change the ``extra.symfony-web-dir `` option in the
101+ `` composer.json `` file:
98102
99- .. code-block :: javascript
103+ .. code-block :: json
100104
101105 {
102- ...
106+ " ..." : " ... " ,
103107 "extra" : {
104- ...
108+ " ..." : " ... " ,
105109 "symfony-web-dir" : " my_new_web_dir"
106110 }
107111 }
@@ -178,6 +182,7 @@ The change in the ``composer.json`` will look like this:
178182 Then, update the path to the ``autoload.php `` file in ``app/autoload.php ``::
179183
180184 // app/autoload.php
185+
181186 // ...
182187 $loader = require '/some/dir/vendor/autoload.php';
183188
0 commit comments