Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • CakePHP Naming Conventions

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 43
    Comment on it

    Hello Readers, this blog tutorial will explain how to use naming convention in CakePHP.
    CakePHP have its own naming convention standards to be used during PHP application development.
    If you want to create application using CakePHP, first you will need to create following files:

    1. file to define the model,

    2 file to define the controller,

    3 files to represent output called presentation files or view files.

    so, while creating model, controller & view files you have to follow CakePHP standards naming conventions

    Table names corresponding to models are plural and underscored.


    Controller classnames are plural, CamelCased, and end in Controller.
    UsersController and PostsController are both examples of cakephp conventional names.


    Model classnames are singular and CamelCased. User, Post are both examples of conventional model names.

    For Example: Table Name-> "findnerds"
    CakePHP naming conventions for model, view, and controller elements.


      filename  =Findnerd.php
      classname =Findnerd
      directory = app/models


      filename  = (same as the action name in the controller)
      extension = .ctp (the filename extension)
      directory = app/views/Findnerds


      filename  = Findnerdscontroller.php
      classname = FindnerdsController
      directory = app/controllers


    Another Example: tables Names-> cities, users_properties
    Controllers should be: CitiesController.php, UsersPropertiesController.php
    Models should be: Administrator.php, City.php, UserProperty.php

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: