Ok, so move your app_controller.php to vendors too, and call
vendor('app_controller'); before calling vendor('model_controller');


On Aug 2, 4:35 pm, safl <[EMAIL PROTECTED]> wrote:
> I just tried out your suggestion, however i ended up with the same
> issue as just doing a "require" from bootstrap.
> The ModuleController can't see AppController and extend that class,
> the actual error msg is:
>
> "Class 'AppController' not found in module_controller.php on line 3".
>
> On Aug 2, 3:05 pm, Grzegorz Pawlik <[EMAIL PROTECTED]> wrote:
>
> > Sorry if i just write 2nd time something- thread is long and i could
> > miss something.
> > Have You tried something like:
>
> > put in /app/vendors file called module_controller.php with definition
> > class ModuleController extends AppController.
> > Then in /config/bootstrap.php call vendor('module_controller');
> > Now your ModuleController should be accessible and it extends your
> > AppController. And some off Your controllers can be an extension of
> > AppController or ModelController- just like (I think) You want to do
> > this. Am I right?
>
> > On Aug 2, 12:59 pm, safl <[EMAIL PROTECTED]> wrote:
>
> > > Hmm unfortunately no. As an example of one of the things that
> > > ModuleController will be doing is this:
>
> > > ...
> > >         var $components = array('Preferences');
> > > ....
> > >         function index() {
> > >                 
> > > $this->redirect($this->Preferences->get('App',$this->name,null,'action'),true);
>
> > >         }
> > > ...
>
> > > What the code does is fetch the preferred action from a users
> > > preferences of any given controller and then redirect the user to that
> > > action.
> > > I used to have that index function defined in all of the controllers
> > > that needed this "preferred redirection", that lead to redundant code
> > > which was a pain to maintain.
>
> > > But since having it in AppController would be very annoying since not
> > > all Controllers must behave like this for their "index".
> > > In some cases doing it would be very wrong (eg. the controller which
> > > handles login/logout stuff among others) and when using scaffolding in
> > > the early stages of adding something new to the project.
>
> > > On Aug 2, 11:57 am, "Jon Bennett" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi Simon,
>
> > > > > Hmm it just seems weird that it's not possible to go down this road..
> > > > > all I'm doing is simple OO.. I'm merely extending an object..
>
> > > > > I've considered another strategy, if you could comment on whether this
> > > > > strides against Cake I would appreciate it very much.
>
> > > > > Inspired by "Scaffold" i could do something like this:
>
> > > > > class Module extends Object {..}
>
> > > > > Then I implement logic in AppController that loads functions and
> > > > > properties from "Module" if "var $module;" is set, just like
> > > > > scaffolding works.
> > > > > Then "modules" are now a new abstract object in cake that wasn't there
> > > > > before, managing logic for controllers with the property of being a
> > > > > "module".
>
> > > > > Is this more in compliance with cake?
>
> > > > hmm, no, not really, at least not IMHO. A more cake way to do it would
> > > > be to have your usual controllers/models/views, which are _generally_
> > > > mapped to your data structure (but not always), and a single
> > > > app_controller. I would then abstract the functionality you require
> > > > for each 'module' into components, and either include them all in
> > > > app_controller, so all controllers have access to the one they need,
> > > > or add the correct one to each controllers own $components array.
>
> > > > Woudl you be able to abstract the code you need like this?
>
> > > > Cheers,
>
> > > > Jon
> > > > ps: lets keep this on-list please.
>
> > > > --
>
> > > > jon bennett
> > > > t: +44 (0) 1225 341 039 w:http://www.jben.net/
> > > > iChat (AIM): jbendotnet Skype: jon-bennett


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to