Global Functions
CakePHP Naming Conventions Models
Controllers
Views
Class Name: singular, camel cased (LineItem, Person)
Class Name: plural, camel cased, ends in "Controller"
Path: controller name, underscored (app/views/line_items/, app/ views/people/)
File Name: singular, underscored (line_item.php, person.php)
(LineItemsController, People Controller)
File Name: plural, underscored (line_items_controller.php, people_controller.php)
Table Name: plural, underscored (line_items, people)
File Name: action name, lowercase (index.thtml, view.thtml)
$recursive $useDbConfig $useTable $validate $validationErrors $_tableInfo
Methods
bindModel (params) create ( ) delete (id, [cascade]) escapeField (field) execute (data) exists ( ) field (name, conditions, order) find ([conditions, fields, order, recursive]) findAll ([conditions, fields, order, limit, page, recur...])
Association Properties $belongsTo $hasAndBelongsToMany $hasMany $hasOne
getLastInsertID ( ) getNumRows ( ) hasAny ([conditions]) hasField (name) invalidate (field) invalidFields ([data]) isForeignKey (field) loadInfo ( ) query ([sql])
Callbacks afterDelete ( ) beforeDelete ( ) beforeFind (&qu..) afterFind (results)
beforeSave ( ) beforeValidate ( )
generateList ([conditions, order, limit, keyPath, val...])
r ('search', 'replace', 'text') pr (array)
debug ('message')
am (array, [array, array]) env ('HTTP_HEADER')
a (element, [element, element]) aa (key, value, [key, value])
cache (path, data, expires, [target])
e ('message')
clearCache ([params, type, ext]) countdim (array)
Properties $name $autoLayout $base $cacheAction $data $here $output $params $plugin $view $webroot
$action $autoRender $beforeFilter $components $helpers $layout $pageTitle $persistModel $uses $viewPath
afterSave ( )
cleanUpFields ( ) constructClasses ( ) flash (message, url, [pause]) flashOut (message, url, [pause]) generateFieldNames (data, doCreateO...) postConditions (data) redirect (url, [status]) referer ([default, local]) render([action, layout, file]) set (one, [two]) setAction (action, [param, param, param]) validate ( ) validateErrors ( )
Callbacks beforeFilter ( ) afterFilter ( )
beforeRender ( )
Global Constants Core Defines ACL_CLASSNAME
CAKE_SESSION_STRING
ACL_FILENAME
Paths
Component
APP
INFLECTIONS
CAKE_SESSION_TABLE
APP_DIR
JS
AUTO_SESSION
CAKE_SESSION_TIMEOUT
APP_PATH
LAYOUTS
CACHE_CHECK
COMPRESS_CSS
CACHE
LIB_TESTS
CAKE_ADMIN
DEBUG
CAKE
LIBS
CAKE_SECURITY
LOG_ERROR
COMPONENTS
LOGS
CAKE_SESSION_COOKIE
MAX_MD5SIZE
CONFIGS
MODEL_TESTS
CAKE_SESSION_SAVE
WEBSERVICES
CONTROLLER_TESTS
MODELS
CONTROLLERS
SCRIPTS
CSS
TESTS
Webroot Configurable Paths
Availability: Controller / View
Properties $disableStartup
Callbacks startup (&controller)
Conventions Class Name: MyCoolComponent Path: app/controllers/components/my_cool.php
Usage
CORE_PATH
ROOT
ELEMENTS
TMP
WWW_ROOT
WEBROOT_DIR
HELPER_TESTS
VENDORS
Controller: $this->MyCool->method( );
HELPERS
VIEWS
View: $this->controller->MyCool->method( );
CAKE_CORE_INCLUDE_PATH
Copyright © 2006, Cake Software Foundation
View Properties $action $autoRender $controller $hasRendered $here $loaded $name $params $plugin $themeWeb $viewPath
$autoLayout $base $ext $helpers $layout $models $pageTitle $parent $subDir $uses
Methods
Methods
getAffectedRows ( ) getColumnType (column) getColumnTypes ( ) getDisplayField ( ) getID ([list])
findCount ([conditions, recursive]) findNeighbours (conditions, field, value)
uses ('file_name') vendor ('file_name')
Controller
read ([fields, id]) remove ([id, cascade]) save ([data, validate, fieldList]) saveField ([name, value, validate]) set (one, [two]) setDataSource (dataSource) setSource (tableName) unbindModel (params) validates ([data])
findAllThreaded([conditions, fields, sort])
up ('string')
low ('STRING')
Model Properties $cacheQueries $data $displayField $id $name $primaryKey
config ('file_name')
element (name) error (code, name, message) pluginView (action, layout) render ([action, layout, file]) renderCache (filename, timeStart) renderElement (name, [params]) renderLayout (content_for_layout) setLayout (layout)
Helper Availability: View only
Properties $tags $base $here $action $themeWeb $view $webroot $params $data $plugin Callbacks afterRender ( )
Conventions Class Name: MyCoolHelper Path: app/views/helpers/my_cool.php
Usage View: $myCool->method( );