On Mon, Aug 16, 2010 at 6:19 PM, Jerome Renard <[email protected]> wrote:
> James,
>
> On Mon, Aug 16, 2010 at 5:52 PM, James Pic <[email protected]> wrote:
>> On Mon, Aug 16, 2010 at 3:47 PM, Jerome Renard <[email protected]> 
>> wrote:
>>> Jame,s
>>>
>>> On Mon, Aug 16, 2010 at 3:27 PM, James Pic <[email protected]> wrote:
>>>> Hello Jerome,
>>>>
>>>> ie.
>>>>
>>>> $final = ezcConfigurationMerger::merge(array(
>>>>   $parent,
>>>>   // [...]
>>>>   $child,
>>>> ));
>>>>
>>>
>>> I would not use an array here, but only 2 arguments, like $parent and 
>>> $child.
>>>
>>
>> I though you wanted to have configuration in multiple directories? ie.
>>
>> array( // in order of importance
>>    '/path/to/project/etc/dev',
>>    '/path/to/app1/etc/dev',
>>    '/path/to/app1/etc/default',
>>    '/path/to/app2/etc/dev',
>>    '/path/to/app2/etc/default',
>> )
>>
>> Didn't what you want look like something like that?
>
> Ideally yes, but if we split features in two different components,
> then we can keep
> the merge feature only in Configuration and all the rest in the other 
> component.
> As long as Configuration provide a merge mechanism between multilple
> configuration groups, then
> you can use this feature for entire files, no matter their location.
> This gives us an interesting flexibility :)

Do you mean that you recommand such a usage:

foreach( $myConfigs as $config ) {
   if ( isset( $previousConfig ) ) {
       $final = mergeFunc( $previousConfig, $config );
   }
   $previousConfig = $config;
}

Instead of:

$final = mergeFunc( $myConfigs );

What flexibility does it brings?

Doesn't the first use case look like boilerplate code?

Regards

James

-- 
http://jamespic.com/contact
Customer is king - Le client est roi - El cliente es rey.

Reply via email to