From The Blog

CakePHP: change default model for a controller

30 November 2012, in

By default a CakePHP controller uses a model with singularized name, for example a controller with name Students will use by default a model named Student,

But if you want or have to change the default model for a controller you can set it using

$modelClass member attribute

for example for a controller named ClassesController and you can't name the model class with name "Class" because it is a keyword in PHP, and you decided to change the model name to Classroom

Class ClassesController extends AppController {

$modelClass = 'Classroom';

....



Post a Comment