Class ItemCollection
Abstract class for database based item collections.
Base class with common features for database based items and item collections.
Methods
CommunicationCollection()
CommunicationCollection()
Inherited
| inherited_from |
\CommunicationCollection::CommunicationCollection() |
NoteCollection()
NoteCollection()
| deprecated |
[2011-03-15] Old constructor function for downwards compatibility |
Constructor Function
__construct()
Adds a result field
addResultField(string $sField)
Inherited
| inherited_from |
\ItemCollection::addResultField() |
| inherited_from |
\CommunicationCollection::addResultField() |
Parameters
$sField
string
Returns the amount of returned items
count() : int
Inherited
| inherited_from |
\ItemCollection::count() |
| inherited_from |
\CommunicationCollection::count() |
Returns
intNumber of rows
create: Creates a new note item.
create(\$itemtype $itemtype, \$itemid $itemid, \$idlang $idlang, \$message $message, $category) : object
Parameters
$itemtype
\$itemtypestring Item type (usually the class name)
$itemid
\$itemidmixed Item ID (usually the primary key)
$idlang
\$idlangint Language-ID
$message
\$messagestring Message to store
$category
Returns
objectThe new item
Deletes an item in the table.
delete(mixed $mId) : bool
Inherited
Deletes also cached e entry and any existing properties.
| inherited_from |
\ItemCollection::delete() |
| inherited_from |
\CommunicationCollection::delete() |
Parameters
$mId
mixedId of entry to delete
Returns
bool
Deletes all found items in the table matching the passed field and it's value.
deleteBy(string $sField, mixed $mValue) : int
Inherited
Deletes also cached e entries and any existing properties.
| inherited_from |
\ItemCollection::deleteBy() |
| inherited_from |
\CommunicationCollection::deleteBy() |
Parameters
$sField
stringThe field name
$mValue
mixedThe value of the field
Returns
intNumber of deleted entries
Deletes all found items in the table matching the rules in the passed where clause.
deleteByWhereClause(string $sWhere) : int
Inherited
Deletes also cached e entries and any existing properties.
| inherited_from |
\ItemCollection::deleteByWhereClause() |
| inherited_from |
\CommunicationCollection::deleteByWhereClause() |
Parameters
$sWhere
stringThe where clause of the SQL statement
Returns
intNumber of deleted entries
Removes a previous set where clause (@see ItemCollection::setWhere).
deleteWhere(string $sField, mixed $mRestriction, string $sOperator)
Inherited
| inherited_from |
\ItemCollection::deleteWhere() |
| inherited_from |
\CommunicationCollection::deleteWhere() |
Parameters
$sField
string
$mRestriction
mixed
$sOperator
string
Removes a previous set groupable where clause (@see ItemCollection::setWhereGroup).
deleteWhereGroup(string $sGroup, string $sField, mixed $mRestriction, string $sOperator)
Inherited
| inherited_from |
\ItemCollection::deleteWhereGroup() |
| inherited_from |
\CommunicationCollection::deleteWhereGroup() |
Parameters
$sGroup
string
$sField
string
$mRestriction
mixed
$sOperator
string
Escape string for using in SQL-Statement.
escape(string $sString) : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::escape() |
| inherited_from |
\ItemCollection::escape() |
| inherited_from |
\CommunicationCollection::escape() |
Parameters
$sString
stringThe string to escape
Returns
stringEscaped string
Checks if a specific entry exists.
exists(mixed $mId) : bool
Inherited
| inherited_from |
\ItemCollection::exists() |
| inherited_from |
\CommunicationCollection::exists() |
Parameters
$mId
mixedThe id to check for (could be numeric or string)
Returns
boolTrue if object exists, false if not
Fetches an array of fields from the database.
fetchArray(string $sKey, mixed $mFields) : array
Inherited
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() |
| inherited_from |
\CommunicationCollection::fetchArray() |
Parameters
$sKey
stringName of the field to use for the key
$mFields
mixedString or array
Returns
arrayResulting array
Loads a single entry by it's id.
fetchById(string | int $id) : \Item
Inherited
| inherited_from |
\ItemCollection::fetchById() |
| inherited_from |
\CommunicationCollection::fetchById() |
Parameters
$id
stringintThe primary key of the item to load.
Returns
Fetches the resultset related to current loaded primary key as a object
fetchObject($sClassName)
Inherited
| inherited_from |
\ItemCollection::fetchObject() |
| inherited_from |
\CommunicationCollection::fetchObject() |
Parameters
fetchTable()
fetchTable(array $aFields, array $aObjects)
Inherited
| inherited_from |
\ItemCollection::fetchTable() |
| inherited_from |
\CommunicationCollection::fetchTable() |
Parameters
$aFields
$aObjects
Selects all entries from the database. Objects are loaded using their primary key.
flexSelect(string $sDistinct, string $sFrom, string $sWhere, string $sGroupBy, string $sOrderBy, string $sLimit) : bool
Inherited
| author |
HerrB |
| inherited_from |
\ItemCollection::flexSelect() |
| inherited_from |
\CommunicationCollection::flexSelect() |
Parameters
$sDistinct
stringSpecifies if distinct will be added to the SQL statement ($sDistinct !== '' -> DISTINCT)
$sFrom
stringSpecifies the additional from clause (e.g. 'con_news_groups AS groups, con_news_groupmembers AS groupmembers').
$sWhere
stringSpecifies the where clause.
$sGroupBy
stringSpecifies the group by clause.
$sOrderBy
stringSpecifies the order by clause.
$sLimit
stringSpecifies the limit by clause.
Returns
boolTrue on success, otherwhise false
Sets the query to use foreign tables in the resultset
link(string $sForeignClass)
Inherited
| inherited_from |
\ItemCollection::link() |
| inherited_from |
\CommunicationCollection::link() |
Parameters
$sForeignClass
stringThe class of foreign table to use
Loads a single object from the database.
loadItem(mixed $mItem) : \Item
Inherited
| inherited_from |
\ItemCollection::loadItem() |
| inherited_from |
\CommunicationCollection::loadItem() |
Parameters
$mItem
mixedThe primary key of the item to load or a recordset with itemdata (array) to inject to the item object.
Exceptions
Returns
\ItemThe newly created object
Advances to the next item in the database.
next() : \Item | bool
Inherited
| inherited_from |
\ItemCollection::next() |
| inherited_from |
\CommunicationCollection::next() |
Returns
\ItemboolThe next object, or false if no more objects
Builds and runs the query
query() : bool
Inherited
| inherited_from |
\ItemCollection::query() |
| inherited_from |
\CommunicationCollection::query() |
Returns
bool
Returns an array of arrays
queryAndFetchStructured(array $aObjects) : array
Inherited
| inherited_from |
\ItemCollection::queryAndFetchStructured() |
| inherited_from |
\CommunicationCollection::queryAndFetchStructured() |
Parameters
$aObjects
arrayWith the correct order of the objects
Returns
arrayResult
Removes existing result field
removeResultField(string $sField)
Inherited
| inherited_from |
\ItemCollection::removeResultField() |
| inherited_from |
\CommunicationCollection::removeResultField() |
Parameters
$sField
string
Resets the properties
resetQuery()
Inherited
| inherited_from |
\ItemCollection::resetQuery() |
| inherited_from |
\CommunicationCollection::resetQuery() |
select: Selects one or more items from the database
select($where, $group_by, $order_by, $limit) : bool
This function only extends the where statement. See the
original function for the parameters.
| access |
public |
| see |
\ItemCollection |
Parameters
$where
$group_by
$order_by
$limit
Returns
boolTrue on success, otherwhise false
Sets the encoding.
setEncoding(string $sEncoding)
Inherited
| inherited_from |
\ItemCollection::setEncoding() |
| inherited_from |
\CommunicationCollection::setEncoding() |
Parameters
$sEncoding
string
Defines how groups are linked to each other
setGroupCondition(string $sGroup1, string $sGroup2, string $sCondition)
Inherited
| inherited_from |
\ItemCollection::setGroupCondition() |
| inherited_from |
\CommunicationCollection::setGroupCondition() |
Parameters
$sGroup1
string
$sGroup2
string
$sCondition
string
Defines how relations in one group are linked each together
setInnerGroupCondition(string $sGroup, string $sCondition)
Inherited
| inherited_from |
\ItemCollection::setInnerGroupCondition() |
| inherited_from |
\CommunicationCollection::setInnerGroupCondition() |
Parameters
$sGroup
string
$sCondition
string
Sets the limit for results
setLimit(int $iRowStart, int $iRowCount)
Inherited
| inherited_from |
\ItemCollection::setLimit() |
| inherited_from |
\CommunicationCollection::setLimit() |
Parameters
$iRowStart
int
$iRowCount
int
Sets the result order part of the query
(e. g. "fieldname", "fieldname DESC", "fieldname DESC, field2name ASC")
setOrder(string $order)
Inherited
| inherited_from |
\ItemCollection::setOrder() |
| inherited_from |
\CommunicationCollection::setOrder() |
Parameters
$order
string
Restricts a query with a where clause
setWhere(string $sField, mixed $mRestriction, string $sOperator)
Inherited
| inherited_from |
\ItemCollection::setWhere() |
| inherited_from |
\CommunicationCollection::setWhere() |
Parameters
$sField
string
$mRestriction
mixed
$sOperator
string
Restricts a query with a where clause, groupable
setWhereGroup(string $sGroup, string $sField, mixed $mRestriction, string $sOperator)
Inherited
| inherited_from |
\ItemCollection::setWhereGroup() |
| inherited_from |
\CommunicationCollection::setWhereGroup() |
Parameters
$sGroup
string
$sField
string
$mRestriction
mixed
$sOperator
string
Builds a where statement out of the setGroupWhere calls
_buildGroupWhereStatements() : array
Inherited
| inherited_from |
\ItemCollection::_buildGroupWhereStatements() |
| inherited_from |
\CommunicationCollection::_buildGroupWhereStatements() |
Returns
arrayWith all where statements
Builds a where statement out of the setWhere calls
_buildWhereStatements() : array
Inherited
| inherited_from |
\ItemCollection::_buildWhereStatements() |
| inherited_from |
\CommunicationCollection::_buildWhereStatements() |
Returns
arrayWith all where statements
Deletes an item in the table, deletes also existing cache entries and
properties of the item.
_delete(mixed $mId) : bool
Inherited
| inherited_from |
\ItemCollection::_delete() |
| inherited_from |
\CommunicationCollection::_delete() |
Parameters
$mId
mixedId of entry to delete
Returns
bool
Fetches all tables which will be joined later on.
_fetchJoinTables(\??? $ignoreRoot) : array
Inherited
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() |
| inherited_from |
\CommunicationCollection::_fetchJoinTables() |
Parameters
$ignoreRoot
\???
Returns
arrayArray structure, see above
Returns reverse join partner.
_findReverseJoinPartner(string $sParentClass, string $sClassName)
Inherited
| inherited_from |
\ItemCollection::_findReverseJoinPartner() |
| inherited_from |
\CommunicationCollection::_findReverseJoinPartner() |
Parameters
$sParentClass
string
$sClassName
string
Returns properties instance, instantiates it if not done before.
_getPropertiesCollectionInstance() : \PropertyCollection
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::_getPropertiesCollectionInstance() |
| inherited_from |
\ItemCollection::_getPropertiesCollectionInstance() |
| inherited_from |
\CommunicationCollection::_getPropertiesCollectionInstance() |
Returns
Returns the second database instance, usable to run additional statements
without losing current query results.
_getSecondDBInstance() : \DB_Contenido
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::_getSecondDBInstance() |
| inherited_from |
\ItemCollection::_getSecondDBInstance() |
| inherited_from |
\CommunicationCollection::_getSecondDBInstance() |
Returns
Initializes the driver to use with GenericDB.
_initializeDriver(\$bForceInit $bForceInit)
Inherited
| inherited_from |
\ItemCollection::_initializeDriver() |
| inherited_from |
\CommunicationCollection::_initializeDriver() |
Parameters
$bForceInit
\$bForceInitboolean If true, forces the driver to initialize, even if it already exists.
_recursiveStructuredFetch()
_recursiveStructuredFetch(array $aObjects, array $aResult)
Inherited
| inherited_from |
\ItemCollection::_recursiveStructuredFetch() |
| inherited_from |
\CommunicationCollection::_recursiveStructuredFetch() |
Parameters
$aObjects
$aResult
Resolves links (class names of joined partners)
_resolveLinks() : array
Inherited
| inherited_from |
\ItemCollection::_resolveLinks() |
| inherited_from |
\CommunicationCollection::_resolveLinks() |
Returns
array
Method to set the accompanying item object.
_setItemClass(string $sClassName) : void
Inherited
| inherited_from |
\ItemCollection::_setItemClass() |
| inherited_from |
\CommunicationCollection::_setItemClass() |
Parameters
$sClassName
stringSpecifies the classname of item
Defines the reverse links for this table.
_setJoinPartner(string $sForeignCollectionClass) : void
Inherited
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() |
| inherited_from |
\CommunicationCollection::_setJoinPartner() |
Parameters
$sForeignCollectionClass
stringSpecifies the foreign class to use
Properties
Storage of the primary key
$primaryKey : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$primaryKey |
| inherited_from |
\ItemCollection::$$primaryKey |
| inherited_from |
\CommunicationCollection::$$primaryKey |
Checks for the virginity of created objects. If true, the object
is virgin and no operations on it except load-Functions are allowed.
$virgin : bool
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$virgin |
| inherited_from |
\ItemCollection::$$virgin |
| inherited_from |
\CommunicationCollection::$$virgin |
Reverse join partners for this data object
$_JoinPartners : array
Inherited
| inherited_from |
\ItemCollection::$$_JoinPartners |
| inherited_from |
\CommunicationCollection::$$_JoinPartners |
Stores all operators which are supported by GenericDB
Unsupported operators are passed trough as-is.
$_aOperators : array
Inherited
| inherited_from |
\ItemCollection::$$_aOperators |
| inherited_from |
\CommunicationCollection::$$_aOperators |
Flag to select all fields in a query. Reduces the number of queries send
to the database.
$_bAllMode : bool
Inherited
| inherited_from |
\ItemCollection::$$_bAllMode |
| inherited_from |
\CommunicationCollection::$$_bAllMode |
Classname of current instance
$_className : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$_className |
| inherited_from |
\ItemCollection::$$_className |
| inherited_from |
\CommunicationCollection::$$_className |
List of instances of ItemCollection implementations
$_collectionCache : array
Inherited
| inherited_from |
\ItemCollection::$$_collectionCache |
| inherited_from |
\CommunicationCollection::$$_collectionCache |
GenericDB driver object
$_driver : \gdbDriver
Inherited
| inherited_from |
\ItemCollection::$$_driver |
| inherited_from |
\CommunicationCollection::$$_driver |
Encoding
$_encoding : string
Inherited
| inherited_from |
\ItemCollection::$$_encoding |
| inherited_from |
\CommunicationCollection::$$_encoding |
Forward join partners for this data object
$_forwardJoinPartners : array
Inherited
| inherited_from |
\ItemCollection::$$_forwardJoinPartners |
| inherited_from |
\CommunicationCollection::$$_forwardJoinPartners |
Group conditions
$_groupConditions : array
Inherited
| inherited_from |
\ItemCollection::$$_groupConditions |
| inherited_from |
\CommunicationCollection::$$_groupConditions |
Inner group conditions
$_innerGroupConditions : array
Inherited
| inherited_from |
\ItemCollection::$$_innerGroupConditions |
| inherited_from |
\CommunicationCollection::$$_innerGroupConditions |
Single item class
$_itemClass : string
Inherited
| inherited_from |
\ItemCollection::$$_itemClass |
| inherited_from |
\CommunicationCollection::$$_itemClass |
Iterator object for the next() method
$_iteratorItem : object
Inherited
| inherited_from |
\ItemCollection::$$_iteratorItem |
| inherited_from |
\CommunicationCollection::$$_iteratorItem |
Item cache instance
$_oCache : \Contenido_ItemCache
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$_oCache |
| inherited_from |
\ItemCollection::$$_oCache |
| inherited_from |
\CommunicationCollection::$$_oCache |
Result fields for the query
$_resultFields : array
Inherited
| inherited_from |
\ItemCollection::$$_resultFields |
| inherited_from |
\CommunicationCollection::$$_resultFields |
GenericDB settings, see $cfg['sql']
$_settings : array
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$_settings |
| inherited_from |
\ItemCollection::$$_settings |
| inherited_from |
\CommunicationCollection::$$_settings |
Where restrictions for the query
$_whereRestriction : array
Inherited
| inherited_from |
\ItemCollection::$$_whereRestriction |
| inherited_from |
\CommunicationCollection::$$_whereRestriction |
Cache the result items
FIXME seems to not used, remove it!
$cache : array
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$cache |
| inherited_from |
\ItemCollection::$$cache |
| inherited_from |
\CommunicationCollection::$$cache |
Database instance, contains the database object
$db : \DB_Contenido
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$db |
| inherited_from |
\ItemCollection::$$db |
| inherited_from |
\CommunicationCollection::$$db |
Storage of the last occured error
$lasterror : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$lasterror |
| inherited_from |
\ItemCollection::$$lasterror |
| inherited_from |
\CommunicationCollection::$$lasterror |
Lifetime of results/created objects?
FIXME Not used at the moment!
$lifetime : int
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$lifetime |
| inherited_from |
\ItemCollection::$$lifetime |
| inherited_from |
\CommunicationCollection::$$lifetime |
Storage of all result items
$objects : string
Inherited
| inherited_from |
\ItemCollection::$$objects |
| inherited_from |
\CommunicationCollection::$$objects |
Property collection instance
$properties : \PropertyCollection
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$properties |
| inherited_from |
\ItemCollection::$$properties |
| inherited_from |
\CommunicationCollection::$$properties |
Second DB instance, is required for some additional queries without
losing an current existing query result.
$secondDb : \DB_Contenido
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$secondDb |
| inherited_from |
\ItemCollection::$$secondDb |
| inherited_from |
\CommunicationCollection::$$secondDb |
Storage of the source table to use for the information
$table : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$table |
| inherited_from |
\ItemCollection::$$table |
| inherited_from |
\CommunicationCollection::$$table |