@@ -12,12 +12,16 @@ directory structure is:
12
12
13
13
your-project/
14
14
├─ app/
15
- │ ├─ cache/
16
15
│ ├─ config/
17
- │ ├─ logs/
18
16
│ └─ ...
19
17
├─ src/
20
18
│ └─ ...
19
+ ├─ tests/
20
+ │ └─ ...
21
+ ├─ var/
22
+ │ ├─ cache/
23
+ │ ├─ logs/
24
+ │ └─ ...
21
25
├─ vendor/
22
26
│ └─ ...
23
27
└─ web/
@@ -41,13 +45,13 @@ in the ``AppKernel`` class of you application::
41
45
42
46
public function getCacheDir()
43
47
{
44
- return $this->rootDir.' /'.$this->environment.'/cache';
48
+ return dirname(__DIR__).'/var /'.$this->environment.'/cache';
45
49
}
46
50
}
47
51
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 ``.
51
55
52
56
.. caution ::
53
57
@@ -74,34 +78,34 @@ method::
74
78
75
79
public function getLogDir()
76
80
{
77
- return $this->rootDir.' /'.$this->environment.'/logs';
81
+ return dirname(__DIR__).'/var /'.$this->environment.'/logs';
78
82
}
79
83
}
80
84
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 ``.
82
86
83
87
.. _override-web-dir :
84
88
85
89
Override the ``web `` Directory
86
90
------------------------------
87
91
88
92
If 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
90
94
in your ``app.php `` and ``app_dev.php `` front controllers. If you simply
91
95
renamed the directory, you're fine. But if you moved it in some way, you
92
96
may need to modify these paths inside those files::
93
97
94
- require_once __DIR__.'/../Symfony /var/bootstrap.php.cache';
98
+ require_once __DIR__.'/../path/to /var/bootstrap.php.cache';
95
99
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:
98
102
99
- .. code-block :: javascript
103
+ .. code-block :: json
100
104
101
105
{
102
- ...
106
+ " ..." : " ... " ,
103
107
"extra" : {
104
- ...
108
+ " ..." : " ... " ,
105
109
"symfony-web-dir" : " my_new_web_dir"
106
110
}
107
111
}
@@ -178,6 +182,7 @@ The change in the ``composer.json`` will look like this:
178
182
Then, update the path to the ``autoload.php `` file in ``app/autoload.php ``::
179
183
180
184
// app/autoload.php
185
+
181
186
// ...
182
187
$loader = require '/some/dir/vendor/autoload.php';
183
188
0 commit comments