Hi Reader's,
Welcome to FindNerd,today we are going to discuss naming conventions in CakePHP.
When implementing a web application in CakePHP, we have to use naming conventions for making any model name and table name etc very carefully.
Firstly when developing CakePHP project we need to manage all folders in a conventions way.
For better understanding see below steps.
1- If we are creating a controller then our folder should be like below
Controller
Dir- app/Controller
2- If we are creating a model then our folder should be like below.
Model
Dir- app/Model
3- If we are creating a view then our folder should be like below
View
Dir-app/View
When we go for creating a database then we should follow below standards.
Note: Table Name must be lowercase and Plural
users, user_tables
If want to create a "Controller" then Controller file names should be in plural and camelcase and filenames must end with ‘Controller.php’. So our Controller file name will like below.
UsersController.php or UsertablesController.php
If want to create a model then Model class name should be in singular.
So our model file name will be like below:
User,UserTable
If want to create a view file then it should end with function_name.ctp
So our model file name will be like below:
user_registration.ctp,uesr_edit.ctp
0 Comment(s)