Himanshu
Himanshu

Reputation: 1443

The best alternative for $this->requestAction()?

I have to call a controller method from another controller and I am using requestAction() for this purpose. I have realized that requestAction is taking a lot of time. Can anybody suggest another function, other than requestAction() to achieve this. Thanks

Upvotes: 2

Views: 642

Answers (2)

dogmatic69
dogmatic69

Reputation: 7585

I would say if you are needing to do this, it is the overall design of your application that needs rethinking.

You can also make your models fatter and then using loadModel() to call the code in the model.

Upvotes: 3

deceze
deceze

Reputation: 522135

Logic that is shared among more than one controller should be put into the AppController, a component or a model, depending on where it fits best. Cross-requesting is expensive however you slice it, if you need to instantiate the other controller.

Upvotes: 2

Related Questions