Item properties
$cacheProviderName
The name of the cache provider to use.
Default: engine
$cacheTtl
The TTL for the cache storage.
Default: CACHE_TTL_NORMAL
$cacheSpecificPrefix
The string to use as the key for this Item in the cache, the value of the idFieldName will be appended.
$databaseProvider
The name of the database provider to use when querying the database for this item.
Default: main
$fields
Hash array specification of the fields on the database table for this item class, where each key is the field name and the value is a hash array with the following keys:
type
The type of the field, one of the availableDATABASE_FIELD_TYPE_?
formItem
A hash array containing the specification of this field when used in forms. Used by ItemAdmin.type
The type of the form item, one of the availableFORM_ITEM_TYPE_?
selectType
When using theFORM_ITEM_TYPE_SELECT
type
, the select type, from one of the following available values:FORM_ITEM_SELECT_TYPE_RADIOS
FORM_ITEM_SELECT_TYPE_COMBO
items
When using theFORM_ITEM_TYPE_SELECT
type
, a hash array of the items available to be selected, where each key is the field value, and each value is a hash array with the following possible keys:title
The title of the select optionsubTitle
The subtitle of the select option
isMultiLanguage
Whether this field stores multi-language data, meaning there are more than one actual fields on the database, one for each available language. As configured in the Locale module's setup keyavailableLanguages
title
The title of the field, to be used when representing data on UI components like UiComponentTableAdmin.prefix
The prefix string to add when humanizing the field value. For example:USD
for american dollar quantities likeUSD300
postfix
The postfix string to add when humanizing the field value. For example:º
for values in degrees like32º
multiplier
A multiplier to apply when humanizing the field value.decimals
The number of decimals to show when humanizing the field valuehumanizeMethodName
A method name to call to humanize the field value. It will receive the Item object as the first and only parameter. If this returns something other than null, the returned value will be used and any other humanizing method and configs likeprefix
,postfix
,multiplier
,decimals
, etc will be omitted.humanizePreMethodName
A method name to call with the field value before any other humanization is done. It will receive the Item object as the first and only parameter.humanizePostMethodName
A method name to call with the field value after any other humanization is done. It will receive the already treated value as the first parameter and the Item object as the second.requestSecurityRules
An array of security rules from the availableSECURITY_RULE_?
that should be applied whenever receiving values for this field in a request, just like the RequestParameter class accepts. Used for example in ItemAdmin.requestFilters
An array of filter from the availableSECURITY_FILTER_?
that should be applied whenever receiving values for this field in a request, just like the RequestParameter class accepts. Used for example in ItemAdmin.validationMethod
An anonymous function to validate the received value for this field, or an array where the first element is the class name, and the second the method name, just like thecall_user_func
PHP function would expect it. Must return an AjaxResponseJson object. Used for example in ItemAdmin.
$idFieldName
The name of the field on the table that uniquely identifies this item on the database table with a numeric id. It should be an auto-increment field.
Default: id
$loadFromIdMethod
The method to use when loading this item from the database via an index. Possible values:
queryDatabaseCache
Load the item from the database using cache.queryDatabase
Load the item from the database without using cache.
Default: queryDatabase
$metaFields
Hash array specification of the fields for this item type that are not fields on the database, but instead fields that interact with the database in a special way. For example, a location
meta field might interact with the database by setting the countryId
, regionId
and cityId
non-meta fields. Each key is the field name, and each value a hash array with following possible keys:
formItem
A hash array containing the specification of this field for forms, used by ItemAdmin, just like theformItem
key in thefields
property.type
The type of the form item, one of the availableFORM_ITEM_META_TYPE_?
levels
ForFORM_ITEM_META_TYPE_MULTILEVEL_SELECT
orFORM_ITEM_META_TYPE_LOCATION
, a hash array where each item represents one level of the multilevel select, the key is the level name and the value is a hash array with the following keys:title
The title of the levelfieldName
The name of the field on the table that stores this level value
$tableName
The name of the database table where this items are stored.
Last updated