There's no merge function. This will work, however:
$config = new Zend_Config($subordinate->asArray() + $master->asArray());
This will allow master values to be redefined in the subordinate. If you
want to prevent that, swap the order.
It would be kind of neat if you could do something like this:
$config = $subordinate->mergeInto($master);
Internally, it would just do what I wrote above, except it wouldn't need to
create a new object and it would honor $allowModifications (I suppose; I
never saw the point of that parameter when it's so easily sidestepped).
Zend_Config::isModifiable() would have to be added in that case. Rob?
-Matt
----- Original Message -----
From: "Steve" <[EMAIL PROTECTED]>
To: <fw-general@lists.zend.com>
Sent: Friday, December 22, 2006 4:03 AM
Subject: [fw-general] Merging two Zend_Configs
Hi,
I've been trying to figure out the best way to merge two Zend_Config objects
together.
What I want to be able to do is have one master INI file in my application
directory and then one INI file per application instance, which will allow
me to override settings in the master INI file. I took a look around the
documentation and the code for Zend_Config but wasn't able to find an
existing way to do this.
What I think I'll have to do is write a recursive iterator or a combination
of asArray() and a custom array_merge function but I wanted to check here if
I'm missing something and if there is an easier way to accomplish this?
Thanks,
Steve