Issues

ZF-388: Instantiation Simplification

Description

Reduce the complexity of instantiation from:


require_once 'Zend/Config.php';
require_once 'Zend/Config/Ini.php';
$config = new Zend_Config(Zend_Config_Ini::load('/path/to/config.ini', 'staging'));

to:


require_once 'Zend/Config/Ini.php';
$config = new Zend_Config_Ini('/path/to/config.ini', 'staging');

Comments

Your proposed syntax would probably require deriving Zend_Config_Ini from Zend_Config to get all the common iteration, counting, __get etc code. During the original proposal process, it was decided that this was not desirable.

I would have thought that a syntax more like Zend_Db would be preferred for consistency?

i.e.


$config = Zend_Config::factory('ini', array('filename'=>'/path/to/config.ini', 
                 'section'=>'staging'));

would be more in line with Zend_Db's system.

Indeed, I left the approach you mention above to be considered as a separate issue, since the two approaches need not be mutually exclusive.

The factory approach remains here for reference purposes; we may end up creating a JIRA issue for this, too.

I'll have some patches ready soon to help resolve this one; I want to coordinate with you on the development and nail down issues with respect to the next release. :)

Fixed with SVN revision 1100