Thank you for the reply, I appreciate the help. I got a hint about what I might need to do from your last point about
CController::action.
My goal is/was to create a function that determines which model(s) the controller is currently using. The more I look into it, the more it makes sense that I'll need to roll my own (simple) functionality for each controller - model relationship, and won't be able to create a
ControllerEx class with a method that just handles this like
YiiBase::app()->getController() handles controllers.
Unless someone has a better idea, I'll create an abstract function in
ControllerEx and each of my controllers will be required to implement
getActiveModels().
I'm a newbie, so am used to what yiic generates, but understand that that's just one way to relate controllers to models. I had been looking at the generated CRUD controllers, and realized that SiteController doesn't follow that pattern since its model, LoginForm, doesn't match the yiic generation pattern, therefore I couldn't universally use the action / controller prefix to determine the model.
Thanks again!
[edited for rather dramatic typo]
jayrulez, on 24 October 2009 - 09:33 AM, said:
Models are independent of Controllers, you can use as many models ad you'd like in any 1 controller, are you confusing models with something else?
<snip>
to get the name of the action use $this->action->id. the actual method name would be 'action'.ucfirst($this->action->id);