Cherrycake
ExamplesGithub
version 2.x alpha
version 2.x alpha
  • Introduction
  • Status
  • Changelog
  • Migration
  • Architecture
    • Basics
    • Modules
    • Classes
    • Lifecycle
      • Deep lifecycle
    • Performance
    • Security
    • Patterns
      • Files structure
    • Items
    • Server requirements
  • Guide
    • Getting started
      • Skeleton start
      • Docker start
    • Modules guide
    • Classes guide
    • Actions guide
      • Complex actions
      • Variable path components
      • Accept GET or POST parameters
      • Getting the URL of an action
      • Cached actions
      • Brute force attacks
    • Patterns guide
      • Passing variables to a pattern
      • Nested patterns
      • Cached patterns
    • Cache guide
      • Time To Live
      • Using cache
      • Lists
      • Queues
      • Pools
    • Database guide
      • Basic queries
      • Prepared queries
      • Cached queries
      • Cache key naming
      • Removing queries from cache
    • Items guide
      • Item cache
      • Item lists
      • Items custom filters
      • Items custom ordering
      • Mixing filters and ordering
      • Items with relationships
      • Items cache
    • HtmlDocument guide
    • Css and Javascript guide
      • Modules injecting CSS and JavaScript
    • Session guide
    • Login guide
      • Creating a complete login workflow
    • Locale guide
      • Multilingual texts
      • Domain based site localization
    • Log guide
      • Loading Log events from the database
    • Stats guide
      • Stats events with additional dimensions
      • Loading Stats events from the database
    • Janitor guide
      • Janitor tasks configuration files
    • Command line interface
    • Debugging
  • Reference
    • Core modules
      • Actions
        • Actions methods
      • Browser
      • Cache
        • Cache methods
      • Css
        • Css methods
      • Database
      • Email
      • Errors
      • HtmlDocument
        • HtmlDocument methods
      • ItemAdmin
      • Janitor
        • Janitor methods
      • Javascript
        • Javascript methods
      • Locale
        • Locale methods
      • Log
        • Log methods
      • Login
        • Login methods
      • Output
        • Output methods
      • Patterns
        • Patterns methods
      • Security
        • Security methods
      • Session
        • Session methods
      • Stats
        • Stats methods
      • SystemLog
      • TableAdmin
      • Translation
      • Validate
    • Core classes
      • Action
        • Action methods
        • Action properties
      • AjaxResponseJson
      • BasicObject
        • BasicObject methods
      • CacheProvider
        • CacheProvider methods
      • Color
      • DatabaseProvider
        • DatabaseProvider methods
      • DatabaseResult
        • DatabaseResult methods
        • DatabaseResult properties
      • DatabaseRow
      • Engine
        • Engine methods
        • Engine properties
      • Gradient
      • Item
        • Item methods
        • Item properties
      • Items
        • Items methods
        • Items properties
      • Image
      • JanitorTask
        • JanitorTask methods
        • JanitorTask properties
      • LogEvent
        • LogEvent methods
        • LogEvent Properties
      • LogEvents
        • LogEvents methods
      • Module
        • Module methods
        • Module properties
      • Response
      • Request
        • Request methods
      • RequestParameter
        • RequestParameter methods
      • RequestPathComponent
        • RequestPathComponent methods
      • Result
      • StatsEvent
        • StatsEvent properties
      • StatsEvents
        • StatsEvents methods
      • SystemLogEvent
        • SystemLogEvent methods
        • SystemLogEvent properties
      • SystemLogEvents
        • SystemLogEvents methods
  • Code conventions
  • License
  • Extras
Powered by GitBook
On this page
  • $cacheProviderName
  • $cacheTtl
  • $cacheSpecificPrefix
  • $databaseProvider
  • $fields
  • $idFieldName
  • $loadFromIdMethod
  • $metaFields
  • $tableName

Was this helpful?

  1. Reference
  2. Core classes
  3. Item

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:

    • selectType When using the FORM_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 the FORM_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 option

      • subTitle The subtitle of the select option

  • 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 like USD300

  • postfix The postfix string to add when humanizing the field value. For example: º for values in degrees like 32º

  • multiplier A multiplier to apply when humanizing the field value.

  • decimals The number of decimals to show when humanizing the field value

  • humanizeMethodName 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 like prefix, 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.

$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:

    • levels For FORM_ITEM_META_TYPE_MULTILEVEL_SELECT or FORM_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 level

      • fieldName 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.

PreviousItem methodsNextItems

Last updated 5 years ago

Was this helpful?

type The type of the field, one of the available

formItem A hash array containing the specification of this field when used in forms. Used by .

type The type of the form item, one of the available

isMultiLanguageWhether 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 module's setup key availableLanguages

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 object as the second.

representFunction An anonymous function that will receive the object. The returned value will be shown to represent this field current value in UI components such as UiComponentItemAdmin when used in conjunction with .

requestSecurityRules An array of security rules from the available that should be applied whenever receiving values for this field in a request, just like the class accepts. Used for example in .

requestFilters An array of filter from the available that should be applied whenever receiving values for this field in a request, just like the class accepts. Used for example in .

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 the call_user_func PHP function would expect it. Must return an object. Used for example in .

formItem A hash array containing the specification of this field for forms, used by ItemAdmin, just like the formItem key in the property.

type The type of the form item, one of the available

ItemAdmin
Locale
Item
Item
ItemAdmin
AjaxResponseJson
ItemAdmin
fields
RequestParameter
ItemAdmin
RequestParameter
ItemAdmin
FORM_ITEM_TYPE_?
FORM_ITEM_META_TYPE_?
DATABASE_FIELD_TYPE_?
SECURITY_RULE_?
SECURITY_FILTER_?