On Feb 2, 8:51 am, Joshua Muheim <[email protected]> wrote: > Thanks Jamie for your interesting thoughts. > > On Tue, Feb 1, 2011 at 8:05 PM, Jamie <[email protected]> wrote: > > And since extending controllers beyond the AppController > > relationship isn't really in the docs and not the "official" way to do > > things, there probably hasn't been much impetus to change the > > behavior. > > The beauty of modern languages and design patterns is the fact that > many things work "automagically" (when I love something of CakePHP, > then this word!). And beneath the fact that in the official docs > nothing is documented that lies a bit above the very basic > functionalities, I want to point out at least my own situation that > has lead me into wishing an inheritance chain for controllers would be > supported by CakePHP: > > I have two kinds of controllers. The first one are the well known > CRUD-controllers that come with a certain model. I need certain > components and helpers for those controllers loaded, and I could be > attempted to place them in the AppController. So for an example, one > of these components "XYZ" takes some action whenever the index() > action is called. > The second kind of controllers are all the other controllers that > deliver non-CRUD-functionality, e.g. PagesController, SearchController > or something like that. Now these controllers don't need the > components of the CRUD-controllers, but when having them placed in > AppController they automatically do! So this is unnecessary overhead, > and also the XYZ component tries to do some action on every > non-CRUD-controller's index() action that could cause problems. > So this leads me to the situation where I have to either load all the > CRUD-components not in the AppController but in every single > CRUD-controller itself, or I have to check within the component > whether the action should be executed or not. Both workarounds aren't > very pretty and lead to duplicated and/or unclean code. > > So again: am I the only person who has ever faced this problem? Or is > it another of those situations I pointed to some posts before...?
I think you're the first person to notice it and not think "oh, 2 secs of editing and I can work on the next part of my problem". AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
