ZF-5973: iterating over a Zend_Config
Description
having a configuration file like this one :
<?xml version="1.0" encoding="UTF-8"?>
/tmp/bla.loglogtimestamppriorityNameprioritymessageuserphp://output
this code fails quite well :
$config = new Zend_Config_Xml('/config/log.xml');
foreach ($config->writer as $writerCfg) {
$writers[$writerCfg->name] = InnoPrim_Log_Writer_Factory::build($writerCfg);
}
the first writerCfg element is "file", which quite not what I asked for.
did I do something wrong?
Comments
Posted by Brice Laurencin (brisssou) on 2009-03-10T06:13:10.000+0000
ok, a new to do it is describe here: http://blog.riff.org/2007_03_19_multiple_entries_w…
Posted by Ben Scholzen (dasprid) on 2009-03-10T06:30:17.000+0000
The reason for this is, that the second level is seen as section-level, which cannot be folded into an array. You have to make your config look something like this:
logtimestamppriorityNameprioritymessageuserphp://outputThen you can iterate over them like this:
Posted by Brice Laurencin (brisssou) on 2009-03-10T06:47:54.000+0000
I tried to iterate it but iterated on $config->writers
sorry to have bothered you.
Thanks a lot for you help!