How to use multiple AppModels?

CakePHP supports just one custom AppModel, which must be placed in the /app folder. If you place another AppModel in the app folder and you try to extend your model from that AppModel, you get a “Class not found” error. To avoid that error you simply have to add a require statement at the top of your model:

require(APP . 'my_special_app_model.php');

class MyModel extends MySpecialAppModel
{
}

The same approach works also for AppControllers.

%d bloggers like this: