|
|||
|
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 ? |
|
|||
|
Quote:
Put delays in a code and draw a debugging output in a browser (function time()). |
|
|||
|
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 |
|
|||
|
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));
Code:
$regisrty = Zend_Registry::get('config');
print_r($regisrty);
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 if you try and access that area Code:
$registry2 = $regisrty['Zend_Config_Ini Object']['db']['adapter'];
print_r($registry2);
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 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);
![]() 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. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|