symfony
symfony forum
Home » support » General discussion » How to add custom yaml file in config, I mean...
How to add custom yaml file in config, I mean... [message #31498] Mon, 16 July 2007 13:44 Go to next message
cysin  is currently offline cysin
Messages: 29
Registered: July 2007
Junior Member
I mean a custom yml file in /config that can be parsed and cached just like app.yml. I've tried the ways demonstrated in wiki and in official document in chapter 19, but it doesn't work.
I added test.yml in /myapp/config/ and changed the config_handlers.php like the following:

config/test.yml
  class:    sfDefineEnvironmentConfigHandler
  param:
    prefix: test_


It seems that it never works as expected. Need I make a change in other config files?(settings.yml for example)

I am new to Symfony, any help is welcome!!!
Re: How to add custom yaml file in config, I mean... [message #31504 is a reply to message #31498 ] Mon, 16 July 2007 15:07 Go to previous messageGo to next message
marksymfony  is currently offline marksymfony
Messages: 55
Registered: March 2007
Location: a
Member

Hi Cysin

is it just a typo? notice that you are missing ':'
after config/test.yml

config/test.yml:
  class:    sfDefineEnvironmentConfigHandler
  param:
    prefix: test_


and also do not forget these in your appname/config/config.php:
<?php
// include project configuration
include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');

// symfony bootstraping
require_once($sf_symfony_lib_dir.'/util/sfCore.class.php');
sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir);

require_once(sfConfigCache::getInstance()->checkConfig('config/test.yml'));


let me know if this solves the problem

[Updated on: Mon, 16 July 2007 15:08]

Re: How to add custom yaml file in config, I mean... [message #31550 is a reply to message #31504 ] Tue, 17 July 2007 03:34 Go to previous message
cysin  is currently offline cysin
Messages: 29
Registered: July 2007
Junior Member
marksymfony wrote on Mon, 16 July 2007 15:07

Hi Cysin

is it just a typo? notice that you are missing ':'
after config/test.yml

config/test.yml:
  class:    sfDefineEnvironmentConfigHandler
  param:
    prefix: test_


and also do not forget these in your appname/config/config.php:
<?php
// include project configuration
include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');

// symfony bootstraping
require_once($sf_symfony_lib_dir.'/util/sfCore.class.php');
sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir);

require_once(sfConfigCache::getInstance()->checkConfig('config/test.yml'));


let me know if this solves the problem

I just solved the problem by your way. I missed ":" in the test.yml, And I added one line in myapp/config/config.php
require_once(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/test.yml'));

It works!
Thank you marksymfony:)
Previous Topic:[performance] propel-build-sql VS propel-build-schema
Next Topic:url_for in method
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software