| | 250 | Scriptable configuration |
|---|
| | 251 | ------------------------ |
|---|
| | 252 | |
|---|
| | 253 | It may happen that your configuration relies on external parameters (such as a database, or another configuration file). For these particular cases, the symfony configuration files are parsed as a PHP file before being passed to the YAML parser. It means that you can write: |
|---|
| | 254 | |
|---|
| | 255 | [php] |
|---|
| | 256 | all: |
|---|
| | 257 | translation: |
|---|
| | 258 | format: <?php echo sfConfig::get('sf_i18n') == true ? 'xliff' : 'none' ?> |
|---|
| | 259 | |
|---|
| | 260 | That's right: *you can put PHP code in YAML files*! |
|---|
| | 261 | |
|---|
| | 262 | Beware though that the configuration is parsed very early in the life of a request, so you will have no symfony built-in methods or functions to help you. If you want one configuration file to rely on another, you have to make sure that the file you rely on is parsed before (look in the [symfony source](http://www.symfony-project.com/trac/browser/trunk/lib/symfony.php) to find in which order the configuration files are parsed). The `app.yml` is one of the last files parsed, so you may rely on others in it. |
|---|
| | 263 | |
|---|
| | 264 | Be also aware that in the production environment, the configuration is cached, so the configuration files are parsed (and executed) only once after the cache is cleared. |
|---|
| | 265 | |
|---|