ZF2-6: Zend_Config_Xml: allow extending for lower levels
Description
It would be great if it is possible to define extends in lower xml structure levels. Take a look at this xml structure below.
sliding7510
I am not sure what to do with {{staging.second-application.entries-per-page}}. Should it use {{entries-per-page=5}} or {{entries-per-page=10}}?
I think this improvement will need a complete refactoring of Zend_Config(_Xml).
Comments
Posted by Jan Pieper (jpieper) on 2009-01-30T09:52:57.000+0000
corrected xml example.
Posted by Jan Pieper (jpieper) on 2009-02-02T16:04:44.000+0000
This evening I tried to solve this issue and I think I´ve found a good way. I used this modified xml structure:
My Zend_Config_Xml::__construct() is:
And I replaced Zend_Config_Xml::_processExtends() with new Zend_Config_Xml::_processExtendsRecursive():
Following script...
...will output this:
I also attached all these changes to Zend_Config_Xml to this issue: zf-5660.diff
Posted by Rob Allen (rob) on 2009-02-02T23:55:18.000+0000
Currently there is feature parity between XML and INI formats. How would this work with the INI file format?
Posted by Jan Pieper (jpieper) on 2009-02-03T01:12:53.000+0000
Yeah I already thought about how to realize this improvement for INI files but I have no really good idea because INI files have only one real dimension. Using "." in INI files to allow multidimensional INI configurations is no standard I think. You can use it for all other applications without any problems but they do not know that you want to define a multidimensional configuration.
will result in:
and not:
Without complete redefinition of our INI format, I think it will be very tricky to allow the same functionality to INI files.
Posted by Ben Scholzen (dasprid) on 2009-02-04T06:17:44.000+0000
This feature cannot be implemented until 2.0 for the following reason: At the moment, the "extend" attribute is only reserved for the section-, but no deeper element. Thus, this feature would break BC, as users could still have used the "extend" attribute in they config files (short param syntax).
Posted by Ben Scholzen (dasprid) on 2009-02-18T08:48:29.000+0000
After talking with Matthew about it, we decided that this break (for XML is allowed).
Posted by Rob Allen (rob) on 2009-03-21T13:04:03.000+0000
Personally, I'm not convinced this is a good idea as it introduces potential confusion and additional complexity when writing config files for relatively little gain.
e.g.
$config->app2->var now equals "three" rather than two as probably expected due to a typo.
However, having said that, if someone develops a patch with unit tests then if Matthew's happy for it to go in, then that's fine.
Posted by Thomas Weidner (thomas) on 2010-03-21T10:27:51.000+0000
Reassigned to component maintainer
Posted by Rob Allen (rob) on 2011-05-27T01:53:39.000+0000
We'll look at this again when refactoring ZF2. I personally think that being able to load a file into another file will solve this one more cleanly with less user confusion.
Posted by Rob Allen (rob) on 2012-04-28T16:14:38.000+0000
Ben: Any thoughts for ZF2?
Posted by Ben Scholzen (dasprid) on 2012-04-29T10:45:44.000+0000
As we are not supporting inheritance in ZF2 anymore, this issue will be closed.