On Feb 19, 2009, at 5:15 PM, Michal Charemza wrote:
Thanks, that does make it clear. Except... On 17 Feb 2009, at 11:52, Felix Gilcher wrote:$animals = include AgaviConfigCache::checkConfig(AgaviConfig::get('core.config_dir').'/ animals.xml');It seems a bit strange that: - There has to be a manual cache check, as this would be repeated wherever I want to access the data. Of course this should happen wherever I want to access the data, but I would have imagined this would be abstracted away somewhere
I fail to see what's strange about that. You can easily wrap the call in a method if you need it. Be aware that AgaviConfigCache::checkConfig() is used for every config file. It only checks if there is a cache config and invokes the configured config handler if needed and a config handler can return about everything - some do actually return code that's executed.
- The whole array is returned. I would have expected there to be a syntax where only specific the specific value that I am after is returned. Something like: $hippoFear = $this->getAppConfig('animals.xml')-getParam('animals','hippo','fear_factor');Or, if I would like the whole 'hippo' array, something like: $hippo = $this->getAppConfig('animals.xml')-getParam('animals','hippo');But maybe this is a bad idea: it's just that, from what I've seen, it seems a bit more 'Agavi' to have this layer of abstraction. But then maybe it's pointless...
Feel free to do something like this:$config = include AgaviConfigCache::checkConfig(AgaviConfig::get('core.config_dir').'/ animals.xml');
$animals = new AgaviParameterHolder($config['animals']);$hippoFear = $animals->getParameter('hippo[fear_factor]', 5); // let's have medium fear factor as default
$hippo = $animals->getParameter('hippo');
Michal.
cheers felix
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ users mailing list [email protected] http://lists.agavi.org/mailman/listinfo/users
