Property collection
Base class with common features for database based items and item collections.
| package | CONTENIDO API |
|---|---|
| subpackage | Model |
| copyright | four for business AG |
ItemCollection($sTable, $sPrimaryKey, $iLifetime)
| inherited_from | \ItemCollection::ItemCollection() |
|---|
__call(string $name, array $arguments) : mixed
Currently it works as a fallback for the not supported method create() which creates a PHP Strict warning.
| inherited_from | \ItemCollection::__call() |
|---|
string
array
mixed__construct() : void
\cInvalidArgumentException |
If table name or primary key is not set |
|---|
_getPropertiesFromCache(mixed $itemtype, mixed $itemid) : array
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
arrayFor each given itemaddResultField(string $sField)
| inherited_from | \ItemCollection::addResultField() |
|---|
string
changeClient(int $idclient)
int
copyItem(object $srcItem, array $fieldsToOverwrite) : object | \Item | null
| inherited_from | \ItemCollection::copyItem() |
|---|
objectSource Item instance to copy
arrayAssoziative list of fields to overwrite.
\cInvalidArgumentException |
If Item class doesn't match the defined _itemClass property or passed Item instance has no loaded recordset |
|---|
count() : int
| inherited_from | \ItemCollection::count() |
|---|
intNumber of rowscreate(mixed $itemtype, mixed $itemid, mixed $type, mixed $name, mixed $value, bool $bInternally) : \cApiProperty
Example: $proerty = $properties->create('idcat', 27, 'visual', 'image', 'images/tool.gif');
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
mixedType of the data to store (arbitary data)
mixedEntry name
mixedValue
boolOptionally default false (on internal call do not escape parameters again
createNewItem(string | array $data) : \Item
| inherited_from | \ItemCollection::createNewItem() |
|---|
stringarrayoptional parameter for direct input of primary key value (string) or multiple column name - value pairs
\ItemThe newly created objectdelete(mixed $mId) : bool
Deletes also cached e entry and any existing properties.
| inherited_from | \ItemCollection::delete() |
|---|
mixedId of entry to delete
booldeleteBy(string $sField, mixed $mValue) : int
Deletes also cached e entries and any existing properties.
| inherited_from | \ItemCollection::deleteBy() |
|---|
stringThe field name
mixedThe value of the field
intNumber of deleted entriesdeleteByMany($values) : bool
Deletes also cached e entries and any existing properties.
| inherited_from | \ItemCollection::deleteByMany() |
|---|
booldeleteByWhereClause(string $sWhere) : int
Deletes also cached e entries and any existing properties.
| inherited_from | \ItemCollection::deleteByWhereClause() |
|---|
stringThe where clause of the SQL statement
intNumber of deleted entriesdeleteProperties(mixed $itemtype, mixed $itemid)
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
deletePropertiesMultiple(mixed $itemtype, array $itemids)
mixedType of the item (example: idcat)
arrayIds of multiple items (example: array(31,12,22))
deleteValue(mixed $itemtype, mixed $itemid, mixed $type, mixed $name)
Example: $properties->deleteValue('idcat', 27, 'visual', 'image');
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
mixedType of the data to store (arbitary data)
mixedEntry name
deleteWhere(string $sField, mixed $mRestriction, string $sOperator)
| inherited_from | \ItemCollection::deleteWhere() |
|---|
string
mixed
string
deleteWhereGroup(string $sGroup, string $sField, mixed $mRestriction, string $sOperator)
| inherited_from | \ItemCollection::deleteWhereGroup() |
|---|
string
string
mixed
string
escape(string $sString) : string
| inherited_from | \cItemBaseAbstract::escape() |
|---|---|
| inherited_from | \ItemCollection::escape() |
stringThe string to escape
stringEscaped stringexists(mixed $mId) : bool
| inherited_from | \ItemCollection::exists() |
|---|
mixedThe id to check for (could be numeric or string)
boolTrue if object exists, false if notfetchArray(string $sKey, mixed $mFields) : array
Example: $i = $object->fetchArray('idartlang', array('idlang', 'name'));
could result in: $i[5] = array('idlang' => 5, 'name' => 'My Article');
Important: If you don't pass an array for fields, the function doesn't create an array.
| inherited_from | \ItemCollection::fetchArray() |
|---|
stringName of the field to use for the key
mixedString or array
arrayResulting arrayfetchById(string | int $id) : \Item
| inherited_from | \ItemCollection::fetchById() |
|---|
stringintThe primary key of the item to load.
\ItemThe loaded itemfetchObject(\Item $sClassName)
fetchTable(array $aFields, array $aObjects)
| inherited_from | \ItemCollection::fetchTable() |
|---|
flexSelect(string $sDistinct, string $sFrom, string $sWhere, string $sGroupBy, string $sOrderBy, string $sLimit) : bool
Objects are loaded using their primary key.
| author | HerrB |
|---|---|
| inherited_from | \ItemCollection::flexSelect() |
stringSpecifies if distinct will be added to the SQL statement ($sDistinct !== '' -> DISTINCT)
stringSpecifies the additional from clause (e.g. 'con_news_groups AS groups, con_news_groupmembers AS groupmembers').
stringSpecifies the where clause.
stringSpecifies the group by clause.
stringSpecifies the order by clause.
stringSpecifies the limit by clause.
boolTrue on success, otherwhise falsegetAllIds() : array
| inherited_from | \ItemCollection::getAllIds() |
|---|
arrayList of idsgetAllValues(mixed $field, mixed $fieldValue, \cAuth $auth) : array
mixedField to search in
mixedValue to search for
arrayFor each given itemgetFieldsByWhereClause(array $aFields, string $sWhere) : array
| inherited_from | \ItemCollection::getFieldsByWhereClause() |
|---|
arrayList of fields to get
stringThe where clause of the SQL statement
arrayList of entries with specified fieldsgetIdsByWhereClause(string $sWhere) : array
| inherited_from | \ItemCollection::getIdsByWhereClause() |
|---|
stringThe where clause of the SQL statement
arrayList of idsgetProperties(mixed $itemtype, mixed $itemid) : array
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
arrayFor each given itemgetValue(mixed $itemtype, mixed $itemid, mixed $type, mixed $name, $default) : mixed
Example: $value = $properties->getValue('idcat', 27, 'visual', 'image');
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
mixedType of the data to store (arbitary data)
mixedEntry name
mixedValuegetValuesByType(mixed $itemtype, mixed $itemid, mixed $type) : array
Example: $values = $properties->getValuesByType('idcat', 27, 'visual');
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
mixedType of the data to store (arbitary data)
arrayValuegetValuesOnlyByTypeName($type, mixed $name) : array
Example: $values = $properties->getValuesOnlyByTypeName('note', 'category');
mixedType of the data to store (arbitary data)
arrayValuelink(string $sForeignClass) : void
| inherited_from | \ItemCollection::link() |
|---|
stringThe class of foreign table to use
\cInvalidArgumentException |
if the given foreign class does not exist |
|---|
loadItem(mixed $mItem) : \Item
| inherited_from | \ItemCollection::loadItem() |
|---|
mixedThe primary key of the item to load or a recordset with itemdata (array) to inject to the item object.
\cException |
If item class is not set |
|---|
\ItemThe newly created objectnext() : \Item | bool
| inherited_from | \ItemCollection::next() |
|---|
\ItemboolThe next object, or false if no more objectsquery() : bool
| inherited_from | \ItemCollection::query() |
|---|
\cException |
if no item class has been set |
|---|
boolqueryAndFetchStructured(array $aObjects) : array
| inherited_from | \ItemCollection::queryAndFetchStructured() |
|---|
arrayWith the correct order of the objects
arrayResultregister(string $event, mixed $callback, mixed $class) : void
Example: cGenericDb::register(cGenericDb::CREATE_SUCCESS, 'itemCreateHandler', 'cApiArticle'); cGenericDb::register(cGenericDb::CREATE_SUCCESS, array('cCallbackHandler', 'executeCreateHandle'), 'cApiArticle');
| inherited_from | \cGenericDb::register() |
|---|---|
| inherited_from | \cItemBaseAbstract::register() |
| inherited_from | \ItemCollection::register() |
stringCallback event, must be a valid value of a cGenericDb event constant
mixedCallback to register
mixedClass name for registering callback (can be string of array with names of the concrete Item classes)
\cInvalidArgumentException |
if event or class are not set or the callback is not callable |
|---|
removeResultField(string $sField)
| inherited_from | \ItemCollection::removeResultField() |
|---|
string
reset()
resetQuery()
| inherited_from | \ItemCollection::resetQuery() |
|---|
select(string $sWhere, string $sGroupBy, string $sOrderBy, string $sLimit) : bool
Objects are loaded using their primary key.
| inherited_from | \ItemCollection::select() |
|---|
stringSpecifies the where clause.
stringSpecifies the group by clause.
stringSpecifies the order by clause.
stringSpecifies the limit by clause.
boolTrue on success, otherwhise falsesetEncoding(string $sEncoding)
| inherited_from | \ItemCollection::setEncoding() |
|---|
string
setGroupCondition(string $sGroup1, string $sGroup2, string $sCondition)
| inherited_from | \ItemCollection::setGroupCondition() |
|---|
string
string
string
setInnerGroupCondition(string $sGroup, string $sCondition)
| inherited_from | \ItemCollection::setInnerGroupCondition() |
|---|
string
string
setLimit(int $iRowStart, int $iRowCount)
| inherited_from | \ItemCollection::setLimit() |
|---|
int
int
setOrder(string $order)
g. "fieldname", "fieldname DESC", "fieldname DESC, field2name ASC")
| inherited_from | \ItemCollection::setOrder() |
|---|
string
setValue(mixed $itemtype, mixed $itemid, mixed $type, mixed $name, mixed $value, int $idProp)
Handles creation and updating. Existing item will be updated, not existing item will be created.
Example: $properties->setValue('idcat', 27, 'visual', 'image', 'images/tool.gif');
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
mixedType of the data to store (arbitary data)
mixedEntry name
mixedValue
intId of database record (if set, update on this basis (possiblity to update name value and type))
setWhere(string $sField, mixed $mRestriction, string $sOperator)
| inherited_from | \ItemCollection::setWhere() |
|---|
string
mixed
string
setWhereGroup(string $sGroup, string $sField, mixed $mRestriction, string $sOperator)
| inherited_from | \ItemCollection::setWhereGroup() |
|---|
string
string
mixed
string
unregister(string $event, mixed $class) : void
Example: cGenericDb::unregister(cGenericDb::CREATE_SUCCESS, 'cApiArticle');
| inherited_from | \cGenericDb::unregister() |
|---|---|
| inherited_from | \cItemBaseAbstract::unregister() |
| inherited_from | \ItemCollection::unregister() |
stringCallback event, must be a valid value of a cGenericDb event constant
mixedClass name for unregistering callback (can be string of array with names of the concrete Item classes)
\cInvalidArgumentException |
if the event or the class are not set |
|---|
_addToCache(\cApiUserProperty $entry)
\cApiUserProperty
_buildGroupWhereStatements() : array
| inherited_from | \ItemCollection::_buildGroupWhereStatements() |
|---|
arrayWith all where statements_buildWhereStatements() : array
| inherited_from | \ItemCollection::_buildWhereStatements() |
|---|
arrayWith all where statements_delete(mixed $mId) : bool
| inherited_from | \ItemCollection::_delete() |
|---|
mixedId of entry to delete
bool_deleteFromCache(int $id)
int
_deleteFromCacheMultiple(array $ids)
array
_deleteMultiple(array $aIds) : int
| inherited_from | \ItemCollection::_deleteMultiple() |
|---|
arrayId of entries to delete
intNumber of affected records_deletePropertiesByIds(array $ids)
Deletes them also from internal cache.
array
_executeCallbacks(string $event, string $class, array $arguments) : void
| inherited_from | \cGenericDb::_executeCallbacks() |
|---|---|
| inherited_from | \cItemBaseAbstract::_executeCallbacks() |
| inherited_from | \ItemCollection::_executeCallbacks() |
stringCallback event, must be a valid value of a cGenericDb event constant
stringClass name for executing callback
arrayArguments to pass to the callback function
\cInvalidArgumentException |
if the event or class is not set |
|---|
_fetchJoinTables(\??? $ignoreRoot) : array
The returned array has the following format:
array(
array(fields),
array(tables),
array(joins),
array(wheres)
);
Notes: The table is the table name which needs to be added to the FROM clause The join statement which is inserted after the master table The where statement is combined with all other where statements The fields to select from
| inherited_from | \ItemCollection::_fetchJoinTables() |
|---|
\???
\cException |
if no join partner could be found |
|---|
arrayArray structure, see above_findReverseJoinPartner(string $sParentClass, string $sClassName)
| inherited_from | \ItemCollection::_findReverseJoinPartner() |
|---|
string
string
_getPropertiesCollectionInstance() : \cApiPropertyCollection
| inherited_from | \cItemBaseAbstract::_getPropertiesCollectionInstance() |
|---|---|
| inherited_from | \ItemCollection::_getPropertiesCollectionInstance() |
_getSecondDBInstance() : \cDb
| inherited_from | \cItemBaseAbstract::_getSecondDBInstance() |
|---|---|
| inherited_from | \ItemCollection::_getSecondDBInstance() |
_getValueFromCache(mixed $itemtype, mixed $itemid, mixed $type, mixed $name, $default) : mixed
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
mixedType of the data to store (arbitary data)
mixedEntry name
mixedValue_getValuesByTypeFromCache(mixed $itemtype, mixed $itemid, mixed $type) : array
mixedType of the item (example: idcat)
mixedID of the item (example: 31)
mixedType of the data to store (arbitary data)
arrayValue_initializeDriver($bForceInit)
| inherited_from | \ItemCollection::_initializeDriver() |
|---|
boolean If true, forces the driver to initialize, even if it already exists.
_loadFromCache()
_recursiveStructuredFetch(array $aObjects, array $aResult)
| inherited_from | \ItemCollection::_recursiveStructuredFetch() |
|---|
_resolveLinks() : array
| inherited_from | \ItemCollection::_resolveLinks() |
|---|
array_setItemClass(string $sClassName) : void
| inherited_from | \ItemCollection::_setItemClass() |
|---|
stringSpecifies the classname of item
\cInvalidArgumentException |
if the given class can not be instantiated |
|---|
_setJoinPartner(string $sForeignCollectionClass) : void
Important: The class specified by $sForeignCollectionClass needs to be a collection class and has to exist. Define all links in the constructor of your object.
| inherited_from | \ItemCollection::_setJoinPartner() |
|---|
stringSpecifies the foreign class to use
\cInvalidArgumentException |
if the given foreign class can not be instantiated |
|---|
_useCache($itemtype, $itemid)
$client : int
$primaryKey : string
| inherited_from | \cItemBaseAbstract::$$primaryKey |
|---|---|
| inherited_from | \ItemCollection::$$primaryKey |
$virgin : bool
If true, the object is virgin and no operations on it except load-Functions are allowed.
| inherited_from | \cItemBaseAbstract::$$virgin |
|---|---|
| inherited_from | \ItemCollection::$$virgin |
$_JoinPartners : array
| inherited_from | \ItemCollection::$$_JoinPartners |
|---|
$_aOperators : array
| inherited_from | \ItemCollection::$$_aOperators |
|---|
$_bAllMode : bool
Reduces the number of queries send to the database.
| inherited_from | \ItemCollection::$$_bAllMode |
|---|
$_cacheItemtypes : array
$_className : string
| inherited_from | \cItemBaseAbstract::$$_className |
|---|---|
| inherited_from | \ItemCollection::$$_className |
$_collectionCache : array
| inherited_from | \ItemCollection::$$_collectionCache |
|---|
$_enableCache : bool
$_encoding : string
| inherited_from | \ItemCollection::$$_encoding |
|---|
$_entries : array
$_forwardJoinPartners : array
| inherited_from | \ItemCollection::$$_forwardJoinPartners |
|---|
$_groupConditions : array
| inherited_from | \ItemCollection::$$_groupConditions |
|---|
$_innerGroupConditions : array
| inherited_from | \ItemCollection::$$_innerGroupConditions |
|---|
$_itemClass : string
| inherited_from | \ItemCollection::$$_itemClass |
|---|
$_iteratorItem : object
| inherited_from | \ItemCollection::$$_iteratorItem |
|---|
$_oCache : \cItemCache
| inherited_from | \cItemBaseAbstract::$$_oCache |
|---|---|
| inherited_from | \ItemCollection::$$_oCache |
$_resultFields : array
| inherited_from | \ItemCollection::$$_resultFields |
|---|
$_settings : array
| inherited_from | \cItemBaseAbstract::$$_settings |
|---|---|
| inherited_from | \ItemCollection::$$_settings |
$_whereRestriction : array
| inherited_from | \ItemCollection::$$_whereRestriction |
|---|
$cache : array
| inherited_from | \cItemBaseAbstract::$$cache |
|---|---|
| inherited_from | \ItemCollection::$$cache |
$lasterror : string
| inherited_from | \cItemBaseAbstract::$$lasterror |
|---|---|
| inherited_from | \ItemCollection::$$lasterror |
$lifetime : int
| inherited_from | \cItemBaseAbstract::$$lifetime |
|---|---|
| inherited_from | \ItemCollection::$$lifetime |
$objects : string
| inherited_from | \ItemCollection::$$objects |
|---|
$properties : \cApiPropertyCollection
| inherited_from | \cItemBaseAbstract::$$properties |
|---|---|
| inherited_from | \ItemCollection::$$properties |
$secondDb : \cDb
| inherited_from | \cItemBaseAbstract::$$secondDb |
|---|---|
| inherited_from | \ItemCollection::$$secondDb |
$table : string
| inherited_from | \cItemBaseAbstract::$$table |
|---|---|
| inherited_from | \ItemCollection::$$table |
$_callbacks : array
| inherited_from | \cGenericDb::$$_callbacks |
|---|---|
| inherited_from | \cItemBaseAbstract::$$_callbacks |
| inherited_from | \ItemCollection::$$_callbacks |
CREATE_BEFORE
Expected parameters for callback: none
| inherited_from | \cGenericDb::CREATE_BEFORE |
|---|---|
| inherited_from | \cItemBaseAbstract::CREATE_BEFORE |
| inherited_from | \ItemCollection::CREATE_BEFORE |
CREATE_FAILURE
Expected parameters for callback: none
| inherited_from | \cGenericDb::CREATE_FAILURE |
|---|---|
| inherited_from | \cItemBaseAbstract::CREATE_FAILURE |
| inherited_from | \ItemCollection::CREATE_FAILURE |
CREATE_SUCCESS
Expected parameters for callback: ID of created item
| inherited_from | \cGenericDb::CREATE_SUCCESS |
|---|---|
| inherited_from | \cItemBaseAbstract::CREATE_SUCCESS |
| inherited_from | \ItemCollection::CREATE_SUCCESS |
DELETE_BEFORE
Expected parameters for callback: ID of them item to delete
| inherited_from | \cGenericDb::DELETE_BEFORE |
|---|---|
| inherited_from | \cItemBaseAbstract::DELETE_BEFORE |
| inherited_from | \ItemCollection::DELETE_BEFORE |
DELETE_FAILURE
Expected parameters for callback: ID of them item to delete
| inherited_from | \cGenericDb::DELETE_FAILURE |
|---|---|
| inherited_from | \cItemBaseAbstract::DELETE_FAILURE |
| inherited_from | \ItemCollection::DELETE_FAILURE |
DELETE_SUCCESS
Expected parameters for callback: ID of them item to delete
| inherited_from | \cGenericDb::DELETE_SUCCESS |
|---|---|
| inherited_from | \cItemBaseAbstract::DELETE_SUCCESS |
| inherited_from | \ItemCollection::DELETE_SUCCESS |
STORE_BEFORE
Expected parameters for callback: Item instance
| inherited_from | \cGenericDb::STORE_BEFORE |
|---|---|
| inherited_from | \cItemBaseAbstract::STORE_BEFORE |
| inherited_from | \ItemCollection::STORE_BEFORE |
STORE_FAILURE
This is also likely to happen if query would not change anything in database! Expected parameters for callback: Item instance
| inherited_from | \cGenericDb::STORE_FAILURE |
|---|---|
| inherited_from | \cItemBaseAbstract::STORE_FAILURE |
| inherited_from | \ItemCollection::STORE_FAILURE |
STORE_SUCCESS
Expected parameters for callback: Item instance
| inherited_from | \cGenericDb::STORE_SUCCESS |
|---|---|
| inherited_from | \cItemBaseAbstract::STORE_SUCCESS |
| inherited_from | \ItemCollection::STORE_SUCCESS |