Why does CakePHP use different conventions for multiple / single naming?

Could someone explain here why on earth CakePHP has a convention on the use of plural names for tables and db controllers and unique for models? Why not always use specific terms or always the plural? It seems confusing to me to always think: "Now am I using the plural or unity here?" (Or is there an easy way to remember?) And then you have connection tables that use a combination of both!

I suppose there is a good reason, but I just haven't come across this.
(I really hope that this is not only because Ruby-on-Rails works that way.)

Simon.

+5
source share
2 answers

CakePHP Conventions

CakePHPs have been banned from years of experience and best practices in web development. Although we suggest that you use these conventions when developing with CakePHP, it should be noted that many of these principles are easily redefined - which is especially convenient when working with legacy systems.

, , , . , . , , . model_id $models, .

$model = $this->Model->find('first');  // reads like English
$model = $this->Models->find('first'); // slightly trips you up

$models = $this->Model->find('all');   // works okay
$models = $this->Models->find('all');  // more logical, but "this models" still trips

, , , . , , .

+10

?

, , (db/model/controller)... (.. User) ( . user_id), . , .

+4

All Articles