<p>I know I mentioned partially about this before...</p>
<p>I have plugin which sets up enviroment. When I want to register another
plugin in contructor i have to set their stackIndex. Well, its pain in the
ass, because I want that application plugin to be first but its registered
ass last one, by default (I don't want to set it manualy).</p>
<p>So, I've got an idea to register filters in routeStartup hook, but front
controller:
<ul>
<li>Do not set request and response objects, when registering in hook
(once again, I have to do it manualy)</li>
<li>Omits hook, where I registered them.</li>
</ul></p>
<pre><code>
class ApplicationPlugin
{
public function routeStartup(Zend_Controller_Request_Http $request)
{
$config = new ConfigPlugin();
// I have to set them, because front controller do that only once
before calling hooks.
$config->setRequest($this->getRequest());
$config->setResponse($this->getResponse());
$this->_frontController->registerPlugin($config);
// routeStartup hook of ConfigPlugin won't be called
}
}
</code></pre>
Alan Gabriel Bem wrote:
>
> I am developing application plugin which sets up enviroment (registers
> other plugins: config, database, user etc.). I want to do that inside
> routeStartup() method (not in constructor, because I do not want to play
> with stack indexes of plugins).
>
> And then problem occures, because response/request objects are not set. I
> know why - front controller sets them up only once, before any routing.
> I Can set them by myself... but WHY? I thing it should be automatic in any
> place.
>
>
> P.S. of course request is passed as parameter of plugin methods, but what
> about response?
>
> 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#a13768002
Sent from the Zend Framework mailing list archive at Nabble.com.