setupAn optional hash array with the following possible setup keys:
loadMethodIf specified, it loads the Item from the database using the given method, from one of the following available loading methods:
fromIdLoads the item identified by the id given in the
fromDataLoads the item using the data passed in the
idThe id on the database of the item to load, when the
dataA hash array containing the data of the item to load, when the
loadMethodis specified, where each key is the field name, and its value the field value.
Throws: An Exception if the item could not be constructed or loaded.
Magic method to return the Item's data corresponding to the given
keyThe key of the data to get, matches the database field name.
Returns: The data, or null if
Magic method to check whether the given
keyexists in the item.
keyThe key of the data to check, matches the database field name.
trueif the key exists,
Magic method to set the item data with the given key to the given value
keyThe key of the data to set, matches the database field name.
Removes this Item from the cache. Can be overloaded if more additional things have to be cleared from cache in relation to the Item.
fieldNamesAn optional array of field names that have been used to query items by index, so those queries will be cleared from cache.
idFieldNameand other field names commonly used by this object are automatically added to this array and cleared from cache.
Deletes this item from the database.
Loads the item with the given data.
Loads the item identified by the given
idfrom the database.
methodThe loading method to use. If not specified, it uses the default Item::$loadFromIdMethod. One of the following values:
queryDatabaseCacheLoad the item from the database using cache.
queryDatabaseLoad the item from the database without using cache.
trueif the item was found and loaded successfully,
Loads the item when no
loadMethodhas been provided on construction. Intended to be overloaded when needed.
dataA hash array with the data. Default:
Updates the data on the database for this Item with the passed
data, or with the data stored on the object if no
dataAn optional hash array where each key is the field name to update, and each value the new data to store on that field for this item. If not passed or left to false, the current data stored in the object is used. Default:
- For multilanguage fields, a hash array must be passed as the value, where each key is one of the available
LANGUAGE_?constants and the value is the value in that language. If a non-array value is passed the currently detected language will be used.