setupAn optional hash array with the following possible setup keys:
fillMethodOptionally specifies the method to use to load Item objects right on the construction of the object. From one of the following possible method keys:
fromParametersMakes a request to the database with the specification passed via the
pkey and loads the resulting Items.
fromDatabaseResultLoads the Items that you've queried on your own, from the passed
databaseResultkey, using the given
fromArrayLoads the Items passed in the
itemLoadMethodThe method to use to load Items when using the
databaseResultThe DatabaseResult object containing the Items to load when using the
keyFieldThe field name that uniquely identifies each item on the table to use when loading Items when using the
itemsAn array of Item objects to load when using the
Throws: An Exception if the item could not be constructed or loaded.
cacheKeyNamingOptionshash array suitable to be used when performing queries to the database or clearing the queries cache.
Returns: True if cache was cleared successfully, false otherwise
When using the CachedKeysPool mechanism, this method removes all the cache entries corresponding to each stored key from cache, effectively clearing all the cached queries related to this Items object.
Returns: True if the cachedKeysPool could be cleared, false otherwise
Fills the list with items loaded according to the given parameters. Intended to be overloaded and called from a parent class.
pA hash array with parameters for loading Items
keyFieldThe name of the field on the database table that uniquely identifies each item, most probably the primary key. Default:
selectsAn array of select SQL parts to select from. Example:
["tableName.*", "tableName2.id"]. Default: All fields from the object's
tablesAn array of tables to be used on the SQL query. Default: This object's
wheresAn array of
whereSQL clauses. Default:
false. Each item is a hash array containing the following keys:
sqlPartThe SQL part of the where, on which each value must represented by a question mark. Example:
fieldName = ?
valuesAn array specifying each of the values used on the
sqlPart, in the same order they're used there. Each item of the array must an array of the following keys:
limitMaximum number of items returned. Default:
orderAn ordered array of orders to apply to results, on which each item can be one of the configured in the
ordersA hash array of the available orders to be applied to results, where each key is the order name as used in the
orderparameter, and the value is the SQL order part. Default: A
randomorder that randomizes results order when used.
orderRandomSeedThe seed to use to randomize results when the
randomorder is used. Default:
isPagingWhether to page results based on the given
pageThe number of page to return when paging is active. Default:
itemsPerPageThe number of items per page when paging is active. Default:
isBuildTotalNumberOfItemsWhether to return the total number of matching items or not in the
totalNumberOfresults key, not taking into account paging configuration. It takes into account
limit, if specified. Default:
isFillItemsWhether to return the matching items or not in the
itemsresults key. Default:
isForceNoCacheIf set to true, the query won't use cache, even if the object is configured to do so. Default:
cacheKeyNamingOptionsIf specified, this cacheKeyNamingOptions will be used instead of the ones built by the buildCacheKeyNamingOptions method. The cache key naming options as specified in Cache::buildCacheKey. Default:
isStoreInCacheWhenNoResultsWhether to store results in cache even when there are no results. Default:
Returns: True if everything went ok, false otherwise.