-- AmirBehzad Eslami <[EMAIL PROTECTED]> wrote
(on Thursday, 10 July 2008, 02:03 PM +0330):
> Hi list,
> I'm trying to store values from a Zend_Config object into Zend_Registry.
>
> $config = new Zend_Config_Xml(APP_DIR . '/config.xml', $curr_env);
> foreach ($config as $key => $value) {
> Zend_Registry::set($key, $value);
> }
>
> As you see, I'm iterating over $config object to store the values into the
> registry.
> Is there any plan to implement a special method (perhaps setFromArray()) to
> facilitate this action? Is there any other way to store multiple values into
> the
> registry at once, with a single line of code?
Umm... why don't you just store the config object in the registry, and
then pull values from there...?
// setting...
Zend_Registry::set('config', $config);
// retrieving...
$env = Zend_Registry::get('config')->env;
This is a much better solution, as then you don't need to worry about
checking to see if various registry keys are set.
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/