Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 08-17-2007, 05:09 AM
Junior Member
 
Join Date: Aug 2007
Posts: 10
Default

Haha ~~
anyway, thx for your help.

My registry problem seems that, the registry only work in the same page/request scope. And it is not work out of that scopes ~

As my knowledge, Zend_Registry is object that like JSP's Application scope which allow to access the same variable/object anywhere by any user. Do I have any misunderstanding ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 08-17-2007, 03:40 PM
Elemental's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 122
Default

I use Registry for global storage, setting many things in the boot strap to be called later in action methods. That is how its supposed to work. Why this problem with arrays exists I'm not sure, but it would be nice to solve.

what if....

Code:
//build your array
  $value = new ArrayObject(
                array(
                    'index' => '123',
                    'xedni' => '456'
                )
              );
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 09-10-2007, 02:28 PM
Junior Member
 
Join Date: Sep 2007
Posts: 2
Default

Quote:
Originally Posted by Elemental View Post
I use Registry for global storage, setting many things in the boot strap to be called later in action methods. That is how its supposed to work. Why this problem with arrays exists I'm not sure, but it would be nice to solve.
Probably code Zend_Registry::Get is executed BEFORE will be executed Zend_Registry::Set.

Put delays in a code and draw a debugging output in a browser (function time()).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 12-11-2007, 01:47 AM
Junior Member
 
Join Date: Dec 2007
Posts: 1
Default

I have a similar problem. I can access all registry object I set in my bootstrap, but If a set Zend_Registry::set('userRoles', $userRoles); when I try to Zend_Registry::get('userRoles') I get key userRoles not found. Has ny on found a solution or work around


Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 12-28-2007, 06:04 PM
Junior Member
 
Join Date: Dec 2007
Posts: 9
Send a message via MSN to blurphp Send a message via Yahoo to blurphp
Default

I am new to zend Framework ut I have noticed something that pertains to this thread.

When you load a config file into the regisrty in the bootstrapper
Code:
$config = new Zend_Config_Ini('application/config/Config.ini', 'general');
Zend_Registry::set('config', array($config));
get this when you dump the registry from the bootstrapper
Code:
$regisrty = Zend_Registry::get('config');
print_r($regisrty);
You get this:
Code:
Zend_Config_Ini Object
(
    [_nestSeparator:protected] => .
    [_allowModifications:protected] => 
    [_index:protected] => 0
    [_count:protected] => 1
    [_data:protected] => Array
        (
            [db] => Zend_Config Object
                (
                    [_allowModifications:protected] => 
                    [_index:protected] => 0
                    [_count:protected] => 2
                    [_data:protected] => Array
                        (
                            [adapter] => Mysqli
                            [params] => Zend_Config Object
                                (
                                    [_allowModifications:protected] => 
                                    [_index:protected] => 0
                                    [_count:protected] => 4
                                    [_data:protected] => Array
                                        (
                                            [dbname] => test
                                            [host] => localhost
                                            [username] => test
                                            [password] => test
                                        )

                                    [_loadedSection:protected] => 
                                    [_extends:protected] => Array
                                        (
                                        )

                                )

                        )

                    [_loadedSection:protected] => 
                    [_extends:protected] => Array
                        (
                        )

                )

        )

    [_loadedSection:protected] => general
    [_extends:protected] => Array
        (
        )

)
Now when you go to the Controller and dump the registry you get the same thing

Now if you try and access that area
Code:
$registry2 = $regisrty['Zend_Config_Ini Object']['db']['adapter'];
        print_r($registry2);
you get
Code:
Fatal error: Cannot use object of type Zend_Config_Ini as array in 
C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Project\application\controllers\UserController.php on line 26
So I think it is setting the whole config file as the value instead of each var.

So I am loading the regisrty manually
Code:
$config = new Zend_Config_Ini('application/config/Config.ini', 'general');
$dbadapter = $config->db->adaptor;
Zend_Registry::set('dbadapter', $dbadapter);
It works. But having the whole file load would be better.

I could be wrong as I am still new to php and zf. Any suggestions on what is happening or how to fix would be appreciated.

Last edited by blurphp : 12-28-2007 at 06:19 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:02 AM.