[fw-general] RE: [fw-mvc] CUSTOM_Controller_Plugin is loaded twice

2010-06-16 Thread Jachim Coudenys
Hi,

You probably use some kind of forwarding in your controller.
That is why it’s called twice.

MvG,

Jachim Coudenys
Web Developer - Guideline Belgium

Van: Enkhbilguun Erdenetsogt [mailto:enkhbilg...@beregu.com]
Verzonden: maandag 14 juni 2010 11:23
Aan: fw-general@lists.zend.com; fw-...@lists.zend.com
Onderwerp: [fw-mvc] CUSTOM_Controller_Plugin is loaded twice

Hello everyone,

I just found that CUSTOM_Controller_Plugin is loaded twice. I don't think it is 
normal.

I'm using ZF 1.10.5 and application.ini registers my Controller Plugins like 
resources.frontController.plugins.Testo = MY_Controller_Plugin_Testo. I just 
var_dump(TESTING); in Testo Controller Plugin and the message is displayed 
twice in my browser.

Do you know how to avoid such duplicated load?



---
Enkhbilguun Erdenetsogt



--

This email was Anti Virus scanned.


[fw-general] Re: [fw-mvc] CUSTOM_Controller_Plugin is loaded twice

2010-06-15 Thread Patrick Figel
Where exactly are you executing var_dump(TESTING);?
It's possible that the plugin event methods are executed more than
once. Consider the following actions:
public function fooAction()
{
echo 'fooAction()br /';
$this-_forward('bar');
}

public function barAction()
{
echo 'barAction()br /';
}

if you then register this controller plugin:
class Vendor_Controller_Plugin_Test extends Zend_Controller_Plugin_Abstract
{

public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$this-getResponse()-appendBody('preDispatch()br /');
}

}

you'll get the following output when calling fooAction:

preDispatch()
fooAction()
preDispatch()
barAction()

This will happen whenever you use _forward (could be triggered in
another controller plugin - e.g. to forward non-authenticated users -
too!) and is expected behaviour. I guess the same applies to the
action() view helper.

hope this helps.



2010/6/14 Enkhbilguun Erdenetsogt enkhbilg...@beregu.com:
 Hello everyone,
 I just found that CUSTOM_Controller_Plugin is loaded twice. I don't think it
 is normal.
 I'm using ZF 1.10.5 and application.ini registers my Controller Plugins
 like resources.frontController.plugins.Testo = MY_Controller_Plugin_Testo.
 I just var_dump(TESTING); in Testo Controller Plugin and the message is
 displayed twice in my browser.
 Do you know how to avoid such duplicated load?


 ---
 Enkhbilguun Erdenetsogt