cakephp use another model inside current model

user765368 picture user765368 · Mar 13, 2012 · Viewed 15.4k times · Source

I know I can use another model inside a controller by doing $this->loadModel("MyModel"), but how do I do this inside another Model? I tried to use loadModel but it didn't work.

Any idea?

Thank you

Answer

Costa picture Costa · Mar 13, 2012

Easier is:

$my_model = ClassRegistry::init('MyModel');

More details: Can I use one model inside of a different model in CakePHP?