Re: [fw-general] Overriding Zend_Controller_Plugin_ErrorHandler
-- Tim Nagel [EMAIL PROTECTED] wrote (on Monday, 27 October 2008, 02:47 PM +1100): I am trying to override the ErrorHandler plugin and I have run into an issue: I have created a plugin, Infinite_Controller_Plugin_ErrorHandler, derived from Zend's copy, and if i register the plugin at stack position 100 (as the current one is done in the Front Controller), I'll get an exception thrown that there is already a plugin registered there when I dispatch. So: 1) Am I doing it wrong? Should I be registering it earlier? 99 instead of 100? Seems an aweful waste to load 2 ErrorHandlers. 2) Should I be setting noErrorHandler to avoid the Front Controller from creating a Zend_Controller_Plugin_ErrorHandler? Seems like this wouldnt be the solution to me This is exactly the solution. 3) Should I be overriding the Front Controller as well? Also seems a bit much to change the ErrorHandler. 4) Is there an issue with the Plugin Broker that it is purely checking the class type in hasPlugin, rather than checking for instanceof? It's not an issue; it's simply the original design of the broker. It existed before we solidified our plugin architecture. 4.1) Should there be a feature or bug request to modify the dispatch function in the Front Controller to use a class variable for where it should look for the ErrorHandler? That's what solution 2 is doing, in essence. ;) Any guidance would be appreciated. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Overriding Zend_Controller_Plugin_ErrorHandler
Well there are basically two ways you could do it. 1. Disable the existing errorHandler with the 'noErrorHandler' front controller param or 2. Unregister it from the plugin broker and register your own. We chose the latter for our own ErrorHandler modifications on lines 261 to ensure compatibility with 'noErrorHander' param http://code.google.com/p/zym/source/browse/trunk/library/Zym/Controller/Plugin/ErrorHandler.php but setting noErrorHandler and registering your own @ 100 should be fine rather than overriding the frontcontroller. Geoffrey Tran Matthew Weier O'Phinney-3 wrote: -- Tim Nagel [EMAIL PROTECTED] wrote (on Monday, 27 October 2008, 02:47 PM +1100): I am trying to override the ErrorHandler plugin and I have run into an issue: I have created a plugin, Infinite_Controller_Plugin_ErrorHandler, derived from Zend's copy, and if i register the plugin at stack position 100 (as the current one is done in the Front Controller), I'll get an exception thrown that there is already a plugin registered there when I dispatch. So: 1) Am I doing it wrong? Should I be registering it earlier? 99 instead of 100? Seems an aweful waste to load 2 ErrorHandlers. 2) Should I be setting noErrorHandler to avoid the Front Controller from creating a Zend_Controller_Plugin_ErrorHandler? Seems like this wouldnt be the solution to me This is exactly the solution. 3) Should I be overriding the Front Controller as well? Also seems a bit much to change the ErrorHandler. 4) Is there an issue with the Plugin Broker that it is purely checking the class type in hasPlugin, rather than checking for instanceof? It's not an issue; it's simply the original design of the broker. It existed before we solidified our plugin architecture. 4.1) Should there be a feature or bug request to modify the dispatch function in the Front Controller to use a class variable for where it should look for the ErrorHandler? That's what solution 2 is doing, in essence. ;) Any guidance would be appreciated. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Overriding-Zend_Controller_Plugin_ErrorHandler-tp20181400p20195181.html Sent from the Zend Framework mailing list archive at Nabble.com.