cakephp-1.3 > TreeBehavior :: generatetreelist()
A AclBase AclBehavior AclComponent AclNode AclShell Aco AcoAction AjaxHelper ApcEngine ApiShell App AppController AppController AppHelper AppHelper AppModel AppModel Aro AuthComponent B BakeShell BakeTask BehaviorCollection C Cache CacheEngine CacheHelper CakeErrorController CakeLog CakeRoute CakeSchema CakeSession CakeSocket ClassRegistry Component Configure ConnectionManager ConsoleShell ContainableBehavior Controller ControllerTask CookieComponent D DataSource DbAcl DbAclSchema DbConfigTask DboMssql DboMysql DboMysqlBase DboMysqli DboOracle DboPostgres DboSource DboSqlite Debugger Dispatcher E EmailComponent ErrorHandler ErrorHandler ExtractTask F File FileEngine FileLog FixtureTask Folder FormHelper H Helper HtmlHelper HttpSocket I I18n I18nModel i18nSchema I18nShell Inflector IniAcl J JavascriptHelper JqueryEngineHelper JsBaseEngineHelper JsHelper L L10n M MagicDb MagicFileResource MediaView MemcacheEngine Model ModelBehavior ModelTask MootoolsEngineHelper Multibyte N NumberHelper O Object Overloadable Overloadable Overloadable2 Overloadable2 P PagesController PagesController PaginatorHelper Permission PluginShortRoute PluginTask ProjectTask PrototypeEngineHelper R RequestHandlerComponent Router RssHelper S Sanitize Scaffold ScaffoldView SchemaShell Security SecurityComponent SessionComponent SessionHelper SessionsSchema Set Shell ShellDispatcher String T TemplateTask TestSuiteShell TestTask TextHelper ThemeView TimeHelper TranslateBehavior TreeBehavior V Validation View ViewTask X XcacheEngine Xml XmlElement XmlHelper XmlManager XmlNode XmlTextNode

generatetreelist

line:317 at /cake/libs/model/behaviors/tree.php
A convenience method for returning a hierarchical array used for HTML select boxes

Method

(array) generatetreelist (&$Model, $conditions = null, $keyPath = null, $valuePath = null, $spacer = '_', $recursive = null)

Parameters

ParameterTypeCommentDefault
$Model AppModel required Model instance
$conditions mixed optional SQL conditions as a string or as an array('field' =>'value',...) null
$keyPath string optional A string path to the key, i.e. "{n}.Post.id" null
$valuePath string optional A string path to the value, i.e. "{n}.Post.title" null
$spacer string optional The character or characters which will be repeated '_'
$recursive integer optional The number of levels deep to fetch associated records null

Return

array

Comment

A convenience method for returning a hierarchical array used for HTML select boxes

@param AppModel $Model Model instance
@param mixed $conditions SQL conditions as a string or as an array('field' =>'value',...)
@param string $keyPath A string path to the key, i.e. "{n}.Post.id"
@param string $valuePath A string path to the value, i.e. "{n}.Post.title"
@param string $spacer The character or characters which will be repeated
@param integer $recursive The number of levels deep to fetch associated records
@return array An associative array of records, where the id is the key, and the display field is the value
@access public
@link http://book.cakephp.org/view/1348/generatetreelist