I read source of Zend_Controller_Plugin_Broker.
Can anybody tell what is that? What is logical purpose of that code?
public function registerPlugin(Zend_Controller_Plugin_Abstract $plugin,
$stackIndex = null)
{
//code
} else {
$stackIndex = count($this->_plugins); // why?
while (isset($this->_plugins[$stackIndex])) {
++$stackIndex;
}
$this->_plugins[$stackIndex] = $plugin;
}
//code
}
Why plugins without passed stackIndex are not registered with lowest posible
stack index?
Look:
$frontController = Zend_Controller_Front::getInstance();
$frontController->setBaseUrl('index.php')
->setControllerDirectory(APPLICATION_DIRECTORY .
'controllers/')
->registerPlugin(new Plugin1(), 99)
->registerPlugin(new Plugin2(), 98)
->registerPlugin(new Plugin3())
->dispatch();
In that example, Plugin3() has $stackIndex = 2 - why not 0? IMO there is
something wrong. Calculating initial $stackIndex is wrong.
Alan Gabriel Bem wrote:
>
> P.P.S. Can somebody tell me: if I register plugin on stack index 4 (1,2,3
> are free) and then I register another plugin without passing stack index,
> what will be its stack index? 5? 1?
>
--
View this message in context:
http://www.nabble.com/Registering-front-controller-plugins-inside-plugins-hooks-tf4786135s16154.html#a13758005
Sent from the Zend Framework mailing list archive at Nabble.com.