2010年1月25日星期一

Re: [fw-mvc] Stop Dispatching Process not working

I think you want to use $request->setDispatched(true). That should inform the dispatcher that the request has already been fulfilled and continue on to postDispatch().

--
Hector


On Mon, Jan 25, 2010 at 5:27 AM, Marcel Alburg <m.alburg@weeaar.com> wrote:
Hello,

is it possible to Implement a Hook/Callback to stop dispatching in the FrontController in a official version of ZF ?

Thanks
Marcel


Am 22.01.2010 um 17:17 schrieb Marcel Alburg:

> Hi,
>
>
> i played with ZF 1.10beta and wrote a Zend_Controller_Plugin
>
>   class Default_Plugin_Cache extends Zend_Controller_Plugin_Abstract
>   {
>     public function preDispatch(Zend_Controller_Request_Abstract $request)
>     {
>        ...
>       $request->setDispatched(false);
>        ...
>     }
>   }
>
> this should stopping the dispatching process but it not works. The snipped (Zend_Controller_Request_Abstract::setDispatched(false);) from the ZF Doku works not too.
>
> if i look in the Zend/Controller/Front.php line 941 i found this
>
>   $this->_plugins->preDispatch($this->_request);
>
>                 /**
>                  * Skip requested action if preDispatch() has reset it
>                  */
>                 if (!$this->_request->isDispatched()) {
>                    continue;
>                 }
>
> i wonder because a continue begins the while loop again. if i change continue to break it works correctly for me.
>
>
> Marcel


没有评论: