Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Naming convention in cakephp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 150
    Comment on it

    Naming convention in cakephp

    To get Maximum advantages from Cakephp then we need to follow some basic naming convention that cakephp rules says.

    Naming convention follows principles of following section of cakephp

    1. Database name
    2. Controller file name
    3. Controller Class Name
    4. View file name
    5. Model file name
    6. Model Class name

    Naming convention of Controller file in cakephp

    In cakephp the controller file always follows plural naming convention.

    CASE-1:

    If a table name is orders in your database,then your controller file name should written like this

    orders_controller.php
    

    Then the Class name should be written like this

    OrdersController
    

    Tips: our table name is order , but at the time of naming the class name ,i have written it as Orders .

    So always keep your table name plural (optional) and lower case.but always starts the class name as Upper case

    like in OrdersController class ,the first letter O is capital but in my database the first letter was lower case.

    At the timing of naming the class ,we should attach the name Controller to the table name,

    like i have attached the word Controller to Orders ,so it becomes OrdersController.

    CASE-2:

    If a table name is users in your database,then your controller file name should written like this

    users_controller.php

    So from above 2 case we found that what ever the table name,our controller file name should contain a S following singular name.

    Then the class name will be

    UsersController

    CASE-3:

    If your database table consist of two words like following example

    suppose the table name is user_profile , then the controller name would be

    user_profiles_controller.php

    Then the class name will be

    UserProfilessController

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
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: