On Wednesday 24 Mar 2010 18:24:00 asagala wrote:
> What do you mean by this "To avoid DRY the code inside the method could be
> replaced with an action helper. "
> 
> Do you mean implement my frontcontroller logic as an action helper and call
> the action helper in preDispatch function on the controllers I need it?

Yes, that's what I mean. If you only need the code in 2 out of 10 controllers, 
it's imho better to do like this:

//nothing
class IndexController {}
// helper
class FooController
{
  public function preDispatch() {some_action_helper():}
}
//helper
class BarController
{
  public function preDispatch () {some_action_helper();}
}
//nothing
class BazController {}

Having 5 out of 10 controller the required methods, I'd let the code stay as 
you had it. If you have 8/10 controllers for the function, I'd look to disable 
the plugin at routeShutdown().
-- 
Jurian Sluiman
CTO Soflomo V.O.F.
http://soflomo.com

Reply via email to