Naming Conventions in CakePHP

1)Name of Controller will always end with ‘s’ like

UsersController

TemplatesController

Users //wrong..must have extension Controller.

2)The table in database have name ending with ‘s’

for UsersController will be Users

for TemplatesController it will be Templates

3)View folders

The name of database table will be same as name of folder where view files are stored.

for UsersController it will be Users(app/view/Users)

4)Each method in Controller will have view

For example

Class UsersController extends AppController

function abc()

{

//whatever

}

will have abc.ctp in Uses folder(app/view/Users/abc.ctp)

5)Example

UsersController //controller name

Users // name of table in database and name of folder stored in app/view

User // name of model singular

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s