In cakephp, whenever you want to create an application, You have to create following three files :
- Model.
- Controller.
- View files.
For all these files, there are some naming convention standard you must follow.
MODEL NAMING CONVENTION : Model Files are located at app/models folder
- These should be camel cased, and if there are more than more than one word used then, it should be separated by underscore.
Example : User.php or User_login.php
- Model file name are singular, usually this should be the database table name but in singular format.
Example : User or UserLogin
CONTROLLER NAMING CONVENTION : Controller Files are located at app/Controller folder.
- Controller file names are plural and camel case, and filenames also end with ‘Controller.php’.
Example : UsersController.php or UsersLoginController.php
VIEW NAMING CONVENTION :
- View files are located at /app/views and with a folder created with its respective controller name, if more than one word then separated by underscore.
- View file names are function_name.ctp. Here, The function name is the name of the function you have defined in your appropriate Controller file.
DATABASE TABLE AND FIELD NAMING CONVENTION :
- Table name must be in lowercase & plural & If there are more than one word in the table name then words should be separated by underscore.
Example : users, consultant_services, etc.
- Field-Name should also be in lowercase and if more than one word then separated by underscore.
Example : id, consultant_service_name
0 Comment(s)