What is the naming convention in cakephp? cakePHP Interview Question

Tuesday, March 31, 2009 16:07
  • Table names are plural and lowercased.
  • Model names are singular and CamelCased: ModelName.
  • Model filenames are singular and underscored: model_name.php.
  • Controller names are plural and CamelCased with *Controller* appended: ControllerNamesController.
  • Controller filenames are plural and underscored with *controller* appended: controller_names_controller.php
  • Associations should use the ModelName, and the order should match the order of the foreignKeys: var $belongsTo = ‘User’;
  • Foreign keys should always be: table_name_in_singular_form_id: user_id (foreign key) → users (table)
  • Many-to-many join tables should be named: alphabetically_first_table_plural_alphabetically_second_table_plural: tags_users , columns in many-to-many join tables should be named like other foreign keys: tag_id and user_id , columns named “created” and “modified” will automatically be populated correctly
  • Share/Bookmark
You can leave a response, or trackback from your own site.

Leave a Reply