Last Updated: February 25, 2016
·
1.236K
· svyelunite

Symfony 1.2: Add a custom config file

Add your xxx.yml to the config directory in the app directory or in the project config directory ( or in the config/custom folder, although this might have been created in my project and not be a symfony standard). Don't forget to add the environment or "all" if you don't want different entries for different environments.

Then add a config_handlers.yml in that same folder if it doesn't exist. In there, add:

path/to/file/xxx.yml:
  class:    sfDefineEnvironmentConfigHandler
  param:
    prefix: chooseYourPrefix_

After that you will have to include the file somewhere so that the .php file that is generated in the cache for configuration files in symfony is actually generated. You can put it in the preExecute function in the actions if it is specific for this action or add a custom filter.

include(sfContext::getInstance()->getConfigCache()->checkConfig('path/to/file/xxx.yml'));

Once you've done this, the file should be in your cache/[frontend | backend]/dev/config/ directory.

Here's the symfony doc, although it didn't help me much particularly with the last part.
http://symfony.com/legacy/doc/book/1_2/en/19-Mastering-Symfony-s-Configuration-Files#chapter_19_sub_adding_your_own_handler