I think you're looking for $controller->modelClass It defaults to either the first uses() model, or Inflector::classify($controllerName)
On Feb 25, 10:15 am, RichardAtHome <[EMAIL PROTECTED]> wrote: > Hi Zoe, > > That's the method I've been using. Not sure if there is a 'better' > way, but it 'works' :-) > > On Feb 23, 10:11 pm, MonkeyGirl <[EMAIL PROTECTED]> wrote: > > > Hi again! > > > I'm discovering the joys of moving a lot of things from individual > > controllers to the app_controller. This means I need to be able to > > work out the controller name and model name for whatever happens to be > > inheriting it at any given time. This is how I'm doing it: > > > $controllerName = $this->params['controller']; // Work out the > > name of the controller > > $modelName = Inflector::classify($controllerName); // Work out the > > name of the controller's corresponding model > > > This method works, but is it the right way of doing it? Should I be > > using the inflector in this way? > > > Thanks, > > Zoe. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
