You are on page 1of 1

CakePHP Naming Conventions Global Functions

config ('file_name') up ('string')


Models Controllers Views uses ('file_name') r ('search', 'replace', 'text')
Class Name: singular, camel cased Class Name: plural, camel cased, Path: controller name, underscored
vendor ('file_name') pr (array)
(LineItem, Person) ends in "Controller" (app/views/line_items/<file>, app/ debug ('message') am (array, [array, array])
(LineItemsController, People Controller) views/people/<file>)
File Name: singular, underscored a (element, [element, element]) env ('HTTP_HEADER')
(line_item.php, person.php)
File Name: plural, underscored aa (key, value, [key, value]) cache (path, data, expires, [target])
File Name: action name, lowercase
(line_items_controller.php, e ('message')
Table Name: plural, underscored
people_controller.php) (index.thtml, view.thtml) clearCache ([params, type, ext])
(line_items, people)
low ('STRING') countdim (array)

Model Controller View


Properties Properties Properties
$cacheQueries $recursive Association Properties $name $action $action $autoLayout
$data $useDbConfig $belongsTo $autoLayout $autoRender $autoRender $base
$displayField $useTable $hasAndBelongsToMany $base $beforeFilter $controller $ext
$id $validate $hasMany $cacheAction $components $hasRendered $helpers
$name $validationErrors $hasOne $data $helpers $here $layout
$primaryKey $_tableInfo $here $layout $loaded $models
$output $pageTitle $name $pageTitle
Methods
getLastInsertID ( ) $params $persistModel $params $parent
bindModel (params)
create ( ) getNumRows ( ) $plugin $uses $plugin $subDir
$view $viewPath $themeWeb $uses
delete (id, [cascade]) hasAny ([conditions])
$webroot $viewPath
escapeField (field) hasField (name)
execute (data) invalidate (field) Methods Methods
exists ( ) invalidFields ([data]) cleanUpFields ( ) element (name)
field (name, conditions, order) isForeignKey (field) constructClasses ( ) error (code, name, message)
find ([conditions, fields, order, recursive]) loadInfo ( ) flash (message, url, [pause]) pluginView (action, layout)
findAll ([conditions, fields, order, limit, page, recur...]) query ([sql]) flashOut (message, url, [pause]) render ([action, layout, file])
findAllThreaded([conditions, fields, sort]) read ([fields, id]) generateFieldNames (data, doCreateO...) renderCache (filename, timeStart)
findCount ([conditions, recursive]) remove ([id, cascade]) postConditions (data) renderElement (name, [params])
findNeighbours (conditions, field, value) save ([data, validate, fieldList]) redirect (url, [status]) renderLayout (content_for_layout)
generateList ([conditions, order, limit, keyPath, val...]) saveField ([name, value, validate]) referer ([default, local]) setLayout (layout)
getAffectedRows ( ) set (one, [two]) render([action, layout, file])
getColumnType (column) setDataSource (dataSource) set (one, [two])
getColumnTypes ( ) setSource (tableName)
setAction (action, [param, param, param])
getDisplayField ( ) unbindModel (params)
validate ( ) Helper
getID ([list]) validates ([data])
validateErrors ( )
Callbacks Availability: View only
beforeDelete ( ) afterDelete ( ) beforeSave ( ) afterSave ( ) Callbacks
Properties
beforeFind (&qu..) afterFind (results) beforeValidate ( ) beforeFilter ( ) beforeRender ( )
$tags
afterFilter ( )
$base
$here
Global Constants $action
$themeWeb
Core Defines Paths Component $view
ACL_CLASSNAME CAKE_SESSION_STRING APP INFLECTIONS
Availability: Controller / View $webroot
ACL_FILENAME CAKE_SESSION_TABLE APP_DIR JS
Properties $params
AUTO_SESSION CAKE_SESSION_TIMEOUT APP_PATH LAYOUTS
$disableStartup $data
CACHE_CHECK COMPRESS_CSS CACHE LIB_TESTS
$plugin
CAKE_ADMIN DEBUG CAKE LIBS Callbacks
CAKE_SECURITY LOG_ERROR COMPONENTS LOGS startup (&controller) Callbacks
CAKE_SESSION_COOKIE MAX_MD5SIZE CONFIGS MODEL_TESTS afterRender ( )
CAKE_SESSION_SAVE WEBSERVICES CONTROLLER_TESTS MODELS Conventions
Class Name: MyCoolComponent Conventions
CONTROLLERS SCRIPTS
Path: app/controllers/components/my_cool.php Class Name: MyCoolHelper
Webroot Configurable Paths CSS TESTS
Path: app/views/helpers/my_cool.php
CORE_PATH ROOT ELEMENTS TMP Usage
WWW_ROOT WEBROOT_DIR HELPER_TESTS VENDORS Controller: $this->MyCool->method( ); Usage
CAKE_CORE_INCLUDE_PATH HELPERS VIEWS View: $this->controller->MyCool->method( ); View: $myCool->method( );

Copyright © 2006, Cake Software Foundation

You might also like