Base class with common features for database based items and item collections.
Methods
Constructor Function
__construct(mixed $mId)
Parameters
$mId
mixedSpecifies the ID of item to load
Exceptions
Filters the passed data using the functions defines in the _arrInFilters array.
_inFilter(mixed $mData) : mixed
Inherited
| see |
\setFilters |
| inherited_from |
\Item::_inFilter() |
Parameters
$mData
mixedData to filter
Returns
mixedFiltered data
cApiClient()
cApiClient($mId)
| deprecated |
[2011-03-15] Old constructor function for downwards compatibility |
Parameters
$mId
Delete client property
deleteProperty(int $iIdProp) : void
Parameters
$iIdProp
intId of property
Deletes a custom property by its id.
deletePropertyById(int $idprop) : bool
Inherited
| inherited_from |
\Item::deletePropertyById() |
Parameters
$idprop
intId of property
Returns
bool
Escape string for using in SQL-Statement.
escape(string $sString) : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::escape() |
| inherited_from |
\Item::escape() |
Parameters
$sString
stringThe string to escape
Returns
stringEscaped string
Wrapper for getField (less to type).
get(string $sField) : mixed
Inherited
| inherited_from |
\Item::get() |
Parameters
$sField
stringSpecifies the field to retrieve
Returns
mixedValue of the field
Gets the value of a specific field.
getField(string $sField) : mixed
Inherited
| inherited_from |
\Item::getField() |
Parameters
$sField
stringSpecifies the field to retrieve
Returns
mixedValue of the field
Static accessor to the singleton instance.
getInstance(int $iClient) : \cApiClient
| todo |
There is no need since caching is available at GenericDB level |
Parameters
$iClient
int
Returns
Get all client properties
getProperties() : array | false
| todo |
return value should be the same as getPropertiesByType(), e. g. an empty array instead false |
Returns
arrayfalseAssoziative array
Get client properties by type
getPropertiesByType(mixed $mType) : array
Parameters
$mType
mixedType of the data to get
Returns
arrayAssoziative array
Get client property
getProperty(mixed $mType, mixed $mName) : mixed
Parameters
$mType
mixedType of the data to get
Returns
mixedValue
Check if client has at least one language
hasLanguages() : bool
Checks if a the item is already loaded.
isLoaded() : bool
Inherited
| inherited_from |
\Item::isLoaded() |
Returns
bool
Loads an item by colum/field from the database.
loadBy(string $sField, mixed $mValue, bool $bSafe) : bool
Inherited
| inherited_from |
\Item::loadBy() |
Parameters
$sField
stringSpecifies the field
$mValue
mixedSpecifies the value
$bSafe
boolUse inFilter or not
Returns
boolTrue if the load was successful
Load dataset by primary key
loadByPrimaryKey(int $iIdKey) : bool
Parameters
$iIdKey
int
Returns
bool
Loads an item by it's recordset.
loadByRecordSet(array $aRecordSet)
Inherited
| inherited_from |
\Item::loadByRecordSet() |
Parameters
$aRecordSet
arrayThe recordset of the item
Shortcut to setField.
set(string $sField, string $mValue, bool $bSafe)
Inherited
| inherited_from |
\Item::set() |
Parameters
$mValue
stringValue to set
$bSafe
boolFlag to run defined inFilter on passed value
Sets the value of a specific field.
setField(string $sField, string $mValue, bool $bSafe)
Inherited
| inherited_from |
\Item::setField() |
Parameters
$mValue
stringValue to set
$bSafe
boolFlag to run defined inFilter on passed value
Define the filter functions used when data is being stored or retrieved
from the database.
setFilters(array $aInFilters, array $aOutFilters) : void
Inherited
Examples:
$obj->setFilters(array('addslashes'), array('stripslashes'));
$obj->setFilters(array('htmlencode', 'addslashes'), array('stripslashes', 'htmlencode'));
| inherited_from |
\Item::setFilters() |
Parameters
$aInFilters
arrayArray with function names
$aOutFilters
arrayArray with function names
Set client property
setProperty(mixed $mType, mixed $mName, mixed $mValue, mixed $mIdproperty) : bool
Parameters
$mType
mixedType of the data to store (arbitary data)
$mIdproperty
mixed
Returns
bool
Stores the loaded and modified item to the database.
store() : bool
Inherited
| inherited_from |
\Item::store() |
Returns
bool
Returns current item data as an assoziative array.
toArray() : array | false
Inherited
| inherited_from |
\Item::toArray() |
Returns
arrayfalse
Returns current item data as an object.
toObject() : \stdClass | false
Inherited
| inherited_from |
\Item::toObject() |
Returns
Lazy instantiation and return of properties object
_getPropertiesCollectionInstance() : \PropertyCollection
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 |
\Item::_getSecondDBInstance() |
Returns
Loads an item by passed where clause from the database.
_loadByWhereClause(string $sWhere) : bool
Inherited
This function is expensive, since it executes allways a query to the database
to retrieve the primary key, even if the record set is aleady cached.
NOTE: Passed value has to be escaped before. This will not be done by this function.
| inherited_from |
\Item::_loadByWhereClause() |
Parameters
$sWhere
stringThe where clause like 'idart = 123 AND idlang = 1'
Returns
boolTrue if the load was successful
Function which is called whenever an item is loaded.
_onLoad() : void
Inherited
Inherited classes should override this function if desired.
| inherited_from |
\Item::_onLoad() |
Filters the passed data using the functions defines in the _arrOutFilters array.
_outFilter(mixed $mData) : mixed
Inherited
| see |
\setFilters |
| inherited_from |
\Item::_outFilter() |
Parameters
$mData
mixedData to filter
Returns
mixedFiltered data
Properties
Storage of the primary key
$primaryKey : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$primaryKey |
| inherited_from |
\Item::$$primaryKey |
Storage of the source table to use for the user informations
$values : array
Inherited
| inherited_from |
\Item::$$values |
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 |
\Item::$$virgin |
List of funcion names of the filters used when data is stored to the db.
$_arrInFilters : array
Inherited
| inherited_from |
\Item::$$_arrInFilters |
List of funcion names of the filtersused when data is retrieved from the db
$_arrOutFilters : array
Inherited
| inherited_from |
\Item::$$_arrOutFilters |
Classname of current instance
$_className : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$_className |
| inherited_from |
\Item::$$_className |
Item cache instance
$_oCache : \Contenido_ItemCache
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$_oCache |
| inherited_from |
\Item::$$_oCache |
GenericDB settings, see $cfg['sql']
$_settings : array
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$_settings |
| inherited_from |
\Item::$$_settings |
Cache the result items
FIXME seems to not used, remove it!
$cache : array
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$cache |
| inherited_from |
\Item::$$cache |
Database instance, contains the database object
$db : \DB_Contenido
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$db |
| inherited_from |
\Item::$$db |
Storage of the last occured error
$lasterror : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$lasterror |
| inherited_from |
\Item::$$lasterror |
Lifetime of results/created objects?
FIXME Not used at the moment!
$lifetime : int
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$lifetime |
| inherited_from |
\Item::$$lifetime |
Storage of the fields which were modified, where the keys are the
fieldnames and the values just simple booleans.
$modifiedValues : array
Inherited
| inherited_from |
\Item::$$modifiedValues |
Stores the old primary key, just in case somebody wants to change it
$oldPrimaryKey : string
Inherited
| inherited_from |
\Item::$$oldPrimaryKey |
Property collection instance
$properties : \PropertyCollection
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$properties |
| inherited_from |
\Item::$$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 |
\Item::$$secondDb |
Storage of the source table to use for the information
$table : string
Inherited
| inherited_from |
\Contenido_ItemBaseAbstract::$$table |
| inherited_from |
\Item::$$table |