4

In Symfony 1.4, is it possible for one to define a custom config file (e.g. my_config.yml) that allows cascading; for instance, having a global custom config file and a module level analogue?

1
  • Out of curiosity, why do you want to do this? Commented May 1, 2011 at 9:51

1 Answer 1

2

Yes.

Define a config handler in config_handlers.yml. It'll probably look like:

config/my_config.yml:
  class: myConfigHandler

Write your config handler. You can look at many of the other config handlers in lib/config for examples. You'll likely want to extend sfYamlConfigHandler.

To access your config values:

sfContext::getInstance()->getConfigCache()->checkConfig('/config/my_config.yml');
Sign up to request clarification or add additional context in comments.

1 Comment

is it a must to define a custom config handler, or is it sometimes ok to use one of the handlers defined in the symfony lib directory? (e.g. sfDefineEnvironmentConfigHandler.class.php)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.