Pages

Wednesday, September 11, 2013

Cakephp-What is the naming convention in cakephp

  1. Table names are plural and lowercased
  2. Model names are singular and CamelCased: ModelName, model filenames are singular: model.php
  3. Controller names are plural and CamelCased with *Controller* appended: ControllerNamesController, controller filenames are named similerly : usersController
  4. Associations should use the ModelName, and the order should match the order of the foreignKeys: var $belongsTo = ‘User’; 
  5. Foreign keys should always be: table_name_in_singular_form_id: user_id (foreign key) → users (table),
  6. many-to-many join tables should be named: alphabetically_first_table_plural_alphabetically_second_table_plural: tags_users ,
  7. columns in many-to-many join tables should be named like other foreign keys: tag_id and user_id ,
  8. columns named “created” and “modified” will automatically be populated correctly

No comments:

Post a Comment