I have several options to solve this issue:

1) My own library has a My_Controller_Action, extending 
Zend_Controller_Action. This controller provides basic functionality used 
through the whole application (extending the __call to access action helpers 
directly, for example).

2) Inside e.g. a projects module, I have an abstract class 
Projects_AbstractController. All other controllers extends this abstract class 
(Projects_IndexController extends Projects_AbstractController).

3) At last, there are action helpers for specific tasks, not used by all 
controllers or all module controllers. These things are located in action 
helpers. Global action helpers are in my library, module specific action 
helpers are down in the module directory.

Regards, Jurian

-- 
Jurian Sluiman
CTO Soflomo V.O.F.
http://soflomo.com

On Tuesday 22 Dec 2009 10:55:09 Cameron wrote:
> What's the deal with haters hatin' on our old friend the base class? Maybe
> you can implement base class functions like getAction using a dispatch
>  level plugin, but how is that better than a simple abstract class to base
>  your controllers around? My actual controllers are 80% method free, it's
>  all done in the base class, I only ever have to override on occasion - it
>  seems like a solid solution to me, why is it considered less than ideal?
> 
> On Tue, Dec 22, 2009 at 5:21 PM, Colin Guthrie <gm...@colin.guthr.ie> wrote:
> > 'Twas brillig, and Taha Bayrak at 22/12/09 06:23 did gyre and gimble:
> > > What is the best practice for placing the base controller classes?
> >
> > Ideally, don't use them at all. You can use action helpers to group up
> > common tasks into one handy call...
> >
> > You can also have plugins work at the dispatch loop level which can be
> > handy.
> >
> > Sometimes it just feels nicer to have a base class tho'.
> >
> > > a. Placing them in the same directory as the other controllers - the
> > > ones that extends from the base class -? If so, is there a easy way to
> > > prevent the base class getting into  the dispatch loop?
> >
> > Just prefix the class with the word "abstract"... i.e. abstract class
> > MyBase_Controller { .... }
> >
> > That way the class cannot be instantiated on it's own. It may be a nasty
> > crash tho'.
> >
> > Personally I'd put it in a subdirectory of the Controller folder to make
> > sure.
> >
> > Col.
> >
> > --
> >
> > Colin Guthrie
> > gmane(at)colin.guthr.ie
> > http://colin.guthr.ie/
> >
> > Day Job:
> >  Tribalogic Limited [http://www.tribalogic.net/]
> > Open Source:
> >  Mandriva Linux Contributor [http://www.mandriva.com/]
> >  PulseAudio Hacker [http://www.pulseaudio.org/]
> >  Trac Hacker [http://trac.edgewall.org/]
> 

Reply via email to