-- Michel Morelli <[EMAIL PROTECTED]> wrote
(on Wednesday, 16 July 2008, 10:00 AM +0200):
> Hi all. I have this code:
>
> <code>
> $configArray = array('LANGUAGE' =>array('it','en'):
> .... [other configArray settings]
>
> $config = new Zend_Config($configArray);
> Zend_Registry::set('config',$config);
> </code>
>
> Now i need to know if a value is stored in LANGUAGE. I have thinked that  
> Zend_registry::get('config')->LANGUAGE returned me an array but on the  
> contrary it returns me an Object.
>
> How can I receive an array from Zend_Registry ?

It's not Zend_Registry returning the object, it's Zend_Config.

When you pass your array to Zend_Config, that class creates an object
for accessing your config values. To cast any given key to an array,
call toArray():

    $languages = $config->LANGUAGE->toArray();

This is also true when you pull the config obect from the registry:

    $languages = Zend_Registry::get('config')->LANGUAGE->toArray();

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to