2010-08-12 64 views
0

無法弄清楚,爲什麼鍵詞在語言插件和定製路徑之間消失。我從模型內部調用註冊表,這是在custome路由中請求的。幫助Zend_Registry刪除鍵字朗出

http://pastie.org/1088574

Message: No entry is registered for key 'lang' 
Stack trace: 

#0 C:\xampp\xampp\htdocs\chat\application\models\Getcategories.php(15): Zend_Registry::get('lang') 
#1 C:\xampp\xampp\htdocs\chat\library\Routes\Categories.php(64): Getcategories->__construct() 
#2 C:\xampp\xampp\htdocs\chat\library\Zend\Controller\Router\Rewrite.php(398): Routes_Categories->match('/ru/woman-searc...') 
#3 C:\xampp\xampp\htdocs\chat\library\Zend\Controller\Front.php(911): Zend_Controller_Router_Rewrite->route(Object(Zend_Controller_Request_Http)) 
#4 C:\xampp\xampp\htdocs\chat\library\Zend\Controller\Front.php(212): Zend_Controller_Front->dispatch() 
#5 C:\xampp\xampp\htdocs\chat\application\Bootstrap.php(65): Zend_Controller_Front::run('C:\xampp\xampp\...') 
#6 C:\xampp\xampp\htdocs\chat\public\index.php(34): Bootstrap->run(Array) 
#7 {main} 

我有語言的插件內檢查時,它註冊郎鍵罰款。

Zend_Registry :: get('lang')裏面的路由也拋出異常。

回答

2

請確保註冊表項設置在Plugins_LangSelector::routeStartup()之內,因此在處理路由之前將會註冊之前的

從ZF-手冊:Plugins

routeStartup()在前端控制器在路由器上呼籲向註冊路由請求之前被調用。

如果您在routeShutdown(),preDispatch(),postDispatch()或dispatchLoopShutdown()中設置了密鑰,那就遲到了。

+0

伴侶!非常感謝你!我不知道preDispatch在匹配路線之前沒有做到這一點。 :\ 現在一切正常。 – Somebody 2010-08-12 17:39:47