wCMF
3.6
|
Public Member Functions | |
RDBMapper ($params) | |
__sleep () | |
connect () | |
getNextId () | |
getSequenceTablename () | |
executeSql ($sql, $isSelect=false) | |
select ($sql, &$pagingInfo) | |
isPkValue ($name, $dataType) | |
constructOID ($type, $data) | |
getPKNamesForType ($type) | |
& | loadImpl ($oid, $buildDepth, $buildAttribs=null, $buildTypes=null) |
& | createImpl ($type, $buildDepth, $buildAttribs=null) |
saveImpl (&$object) | |
deleteImpl ($oid, $recursive=true) | |
& | getConnection () |
getOIDs ($type, $criteria=null, $orderby=null, &$pagingInfo) | |
loadObjects ($type, $buildDepth, $criteria=null, $orderby=null, &$pagingInfo, $buildAttribs=null, $buildTypes=null, $selectChildOIDs=true, $omitObjects=false) | |
& | createObjectFromData ($attribs, $data=null) |
appendChildData (&$object, $buildDepth, $buildAttribs=null, $buildTypes=null) | |
startTransaction () | |
commitTransaction () | |
rollbackTransaction () | |
& | createObject ($oid=null) |
appendObject (&$object, &$dependendObject) | |
applyDataOnLoad (&$object, $objectData, $attribs) | |
applyDataOnCreate (&$object, $objectData, $attribs) | |
prepareInsert (&$object) | |
getType () | |
getObjectDefinition () | |
getSelectSQL ($condStr, $orderStr=null, $attribs=null, $asArray=false) | |
getChildrenSelectSQL ($oid, $compositionOnly=false) | |
getChildrenDisassociateSQL ($oid, $sharedOnly=false) | |
getInsertSQL (&$object) | |
getUpdateSQL (&$object) | |
getDeleteSQL ($oid) | |
createPKCondition ($oid) | |
Public Member Functions inherited from PersistenceMapper | |
getType () | |
getPkNames () | |
setDataConverter ($dataConverter) | |
getDataConverter () | |
enableLogging ($logStrategy) | |
disableLogging () | |
isLogging () | |
logAction (&$obj) | |
& | load ($oid, $buildDepth, $buildAttribs=null, $buildTypes=null) |
& | create ($type, $buildDepth, $buildAttribs=null) |
save (&$object) | |
delete ($oid, $recursive=true) | |
checkAuthorization ($oid, $action) | |
authorizationFailedError ($oid, $action) | |
initialize (&$object) | |
isValidOID ($oid) | |
& | loadImpl ($oid, $buildDepth, $buildAttribs=null, $buildTypes=null) |
& | createImpl ($type, $buildDepth, $buildAttribs=null) |
saveImpl (&$object) | |
deleteImpl ($oid, $recursive=true) | |
getOIDs ($type, $criteria=null, $orderby=null, &$pagingInfo) | |
loadObjects ($type, $buildDepth, $criteria=null, $orderby=null, &$pagingInfo, $buildAttribs=null, $buildTypes=null) | |
getOrderBy () | |
startTransaction () | |
commitTransaction () | |
rollbackTransaction () | |
Public Attributes | |
$_connParams = null | |
$_conn = null | |
$_dbPrefix = '' | |
$_idSelectStmt = null | |
$_idInsertStmt = null | |
$_idUpdateStmt = null | |
Public Attributes inherited from PersistenceMapper | |
$_dataConverter = null | |
$_type = '' | |
$_logging = false | |
$_logStrategy = null | |
RDBMapper maps objects of one type to a relational database schema. It defines a persistence mechanism that specialized mappers customize by overriding the given template methods.
wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH
Licensed under the terms of any of the following licenses at your choice:
See the license.txt file distributed with this work for additional information.
Definition at line 36 of file class.RDBMapper.php.
RDBMapper::RDBMapper | ( | $params | ) |
Constructor.
params | Initialization data given in an assoziative array with the following keys: dbType, dbHostName, dbUserName, dbPassword, dbName OR dbConnection if dbPrefix is given it will be appended to every table string, which is usefull if different cms operate on the same database |
Definition at line 54 of file class.RDBMapper.php.
RDBMapper::__sleep | ( | ) |
Select data to be stored in the session. PDO throws an excetption if tried to be (un-)serialized.
Definition at line 64 of file class.RDBMapper.php.
RDBMapper::connect | ( | ) |
Actually connect to the database using the parameters given to the constructor.
Definition at line 72 of file class.RDBMapper.php.
References PersistenceFacade\getInstance(), and WCMFException\throwEx().
Referenced by commitTransaction(), deleteImpl(), executeSql(), getConnection(), loadObjects(), rollbackTransaction(), saveImpl(), select(), and startTransaction().
RDBMapper::getNextId | ( | ) |
Get a new id for inserting into the database
Definition at line 117 of file class.RDBMapper.php.
References Log\error(), PersistenceFacade\getInstance(), and WCMFException\throwEx().
Referenced by NodeUnifiedRDBMapper\prepareInsert().
RDBMapper::getSequenceTablename | ( | ) |
Get the name of the sequence table
Definition at line 154 of file class.RDBMapper.php.
References PersistenceFacade\getInstance().
RDBMapper::executeSql | ( | $sql, | |
$isSelect = false |
|||
) |
Execute a query on the connection.
sql | The sql command |
isSelect | True/False wether the statement is a select statement (default: false) |
Definition at line 168 of file class.RDBMapper.php.
References connect(), Log\debug(), Log\error(), WCMFException\getStackTrace(), Log\isDebugEnabled(), and WCMFException\throwEx().
Referenced by deleteImpl(), saveImpl(), and select().
RDBMapper::select | ( | $sql, | |
& | $pagingInfo | ||
) |
Execute a select query on the connection.
sql | The sql command |
pagingInfo | An PagingInfo instance describing which page to load |
Definition at line 199 of file class.RDBMapper.php.
References connect(), Log\error(), executeSql(), and WCMFException\throwEx().
Referenced by loadObjects().
RDBMapper::isPkValue | ( | $name, | |
$dataType | |||
) |
Check if a value is a primary key value
name | The name of the value |
dataType | The datatype of the value |
Definition at line 236 of file class.RDBMapper.php.
Referenced by NodeRDBMapper\applyDataOnCreate(), and saveImpl().
RDBMapper::constructOID | ( | $type, | |
$data | |||
) |
Construct an object id from given row data
type | The type of object |
data | An associative array with the pk column names as keys and pk values as values |
Definition at line 247 of file class.RDBMapper.php.
References PersistenceFacade\composeOID(), and getPKNamesForType().
Referenced by createObjectFromData(), and getOIDs().
RDBMapper::getPKNamesForType | ( | $type | ) |
Get the pk column names for a given type
type | The type of object |
Definition at line 261 of file class.RDBMapper.php.
References PersistenceFacade\getInstance().
Referenced by constructOID().
& RDBMapper::loadImpl | ( | $oid, | |
$buildDepth, | |||
$buildAttribs = null , |
|||
$buildTypes = null |
|||
) |
Definition at line 271 of file class.RDBMapper.php.
References createPKCondition(), PersistenceFacade\getInstance(), and PersistenceFacade\getOIDParameter().
& RDBMapper::createImpl | ( | $type, | |
$buildDepth, | |||
$buildAttribs = null |
|||
) |
Definition at line 289 of file class.RDBMapper.php.
References appendObject(), BUILDDEPTH_INFINITE, BUILDDEPTH_MAX, BUILDDEPTH_REQUIRED, BUILDDEPTH_SINGLE, createObjectFromData(), PersistenceFacade\getInstance(), getObjectDefinition(), getType(), and WCMFException\throwEx().
RDBMapper::saveImpl | ( | & | $object | ) |
Definition at line 343 of file class.RDBMapper.php.
References connect(), executeSql(), getInsertSQL(), PersistenceFacade\getInstance(), getUpdateSQL(), isPkValue(), PersistenceMapper\logAction(), prepareInsert(), STATE_CLEAN, STATE_DIRTY, and STATE_NEW.
RDBMapper::deleteImpl | ( | $oid, | |
$recursive = true |
|||
) |
Definition at line 413 of file class.RDBMapper.php.
References BUILDDEPTH_SINGLE, connect(), executeSql(), getChildrenDisassociateSQL(), getChildrenSelectSQL(), getDeleteSQL(), PersistenceFacade\getInstance(), PersistenceMapper\isLogging(), and PersistenceMapper\logAction().
& RDBMapper::getConnection | ( | ) |
Get the database connection.
Definition at line 457 of file class.RDBMapper.php.
References $_conn, and connect().
Referenced by NodeUnifiedRDBMapper\quote().
RDBMapper::getOIDs | ( | $type, | |
$criteria = null , |
|||
$orderby = null , |
|||
& | $pagingInfo | ||
) |
Definition at line 468 of file class.RDBMapper.php.
References BUILDDEPTH_SINGLE, constructOID(), getType(), and loadObjects().
RDBMapper::loadObjects | ( | $type, | |
$buildDepth, | |||
$criteria = null , |
|||
$orderby = null , |
|||
& | $pagingInfo, | ||
$buildAttribs = null , |
|||
$buildTypes = null , |
|||
$selectChildOIDs = true , |
|||
$omitObjects = false |
|||
) |
Definition at line 490 of file class.RDBMapper.php.
References appendChildData(), BUILDDEPTH_INFINITE, BUILDDEPTH_SINGLE, connect(), createObjectFromData(), getSelectSQL(), getType(), select(), STATE_CLEAN, and WCMFException\throwEx().
Referenced by getOIDs().
& RDBMapper::createObjectFromData | ( | $attribs, | |
$data = null |
|||
) |
Create an object of the mapper's type with the given attributes from the given data
attribs | An array of attributes to create |
data | The '_data' array contained in the array returned by getObjectDefinition |
Definition at line 561 of file class.RDBMapper.php.
References applyDataOnCreate(), applyDataOnLoad(), constructOID(), createObject(), getObjectDefinition(), and getType().
Referenced by createImpl(), and loadObjects().
RDBMapper::appendChildData | ( | & | $object, |
$buildDepth, | |||
$buildAttribs = null , |
|||
$buildTypes = null |
|||
) |
Append the child data to an object. If the buildDepth does not determine to load a child generation, only the oids of the children will be loaded.
object | A reference to the object to append the children to |
buildDepth |
buildAttribs |
buildTypes |
Definition at line 604 of file class.RDBMapper.php.
References appendObject(), BUILDDEPTH_INFINITE, BUILDDEPTH_SINGLE, getChildrenSelectSQL(), and PersistenceFacade\getInstance().
Referenced by loadObjects().
RDBMapper::startTransaction | ( | ) |
Definition at line 635 of file class.RDBMapper.php.
References connect().
RDBMapper::commitTransaction | ( | ) |
Definition at line 645 of file class.RDBMapper.php.
References connect().
RDBMapper::rollbackTransaction | ( | ) |
Definition at line 656 of file class.RDBMapper.php.
References connect().
& RDBMapper::createObject | ( | $oid = null | ) |
TEMPLATE METHODS Subclasses must implement this method to define their object type. Factory method for the supported object type.
oid | The object id (maybe null) |
Definition at line 675 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by createObjectFromData().
RDBMapper::appendObject | ( | & | $object, |
& | $dependendObject | ||
) |
Add a dependend object (child) to an object.
object | The object to add to. |
dependendObject | The object to add. |
Definition at line 685 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by appendChildData(), and createImpl().
RDBMapper::applyDataOnLoad | ( | & | $object, |
$objectData, | |||
$attribs | |||
) |
Apply the loaded object data to the object.
object | A reference to the object created with createObject method to which the data should be applied |
objectData | The array returned by the getObjectDefinition method with the '_data' array filled with the rows returned by execution of the database select statement (given by getSelectSQL). These rows hold the loaded data. |
attribs | The build attributes for the type of object (given in the buildAttribs parameter of the loadImpl method) |
Definition at line 698 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by createObjectFromData().
RDBMapper::applyDataOnCreate | ( | & | $object, |
$objectData, | |||
$attribs | |||
) |
Apply the default data to the object.
object | A reference to the object created with createObject method to which the data should be applied |
objectData | The array returned by the getObjectDefinition method. The default data are extracted from this. |
attribs | The build attributes for the type of object (given in the buildAttribs parameter of the loadImpl method). |
Definition at line 709 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by createObjectFromData().
RDBMapper::prepareInsert | ( | & | $object | ) |
Set the object primary key values for inserting the object to the database.
object | A reference to the object to insert. |
Definition at line 720 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by saveImpl().
RDBMapper::getType | ( | ) |
Get the object type this mapper supports.
Definition at line 729 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by createImpl(), TableRDBMapper\createObject(), NodeRDBMapper\createObject(), createObjectFromData(), NodeUnifiedRDBMapper\getColumnName(), getOIDs(), TableUnifiedRDBMapper\getSelectSQL(), TableUnifiedRDBMapper\getUpdateSQL(), TableUnifiedRDBMapper\isValidOID(), NodeUnifiedRDBMapper\isValidOID(), loadObjects(), and NodeUnifiedRDBMapper\translateAppToDatabase().
RDBMapper::getObjectDefinition | ( | ) |
Get the object type definition.
Definition at line 750 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by createImpl(), and createObjectFromData().
RDBMapper::getSelectSQL | ( | $condStr, | |
$orderStr = null , |
|||
$attribs = null , |
|||
$asArray = false |
|||
) |
Get the SQL command to select object data from the database.
condStr | The condition string (without 'WHERE'). |
orderStr | The order string (without 'ORDER BY') (default: null uses default order). |
attribs | An array listing the attributes to load (default: null loads all attributes). |
asArray | True to get an associative array with keys 'attributeStr', 'tableStr', 'conditionStr', 'orderStr' and the appropriate query parts as value. [default: false] |
Definition at line 767 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by loadObjects().
RDBMapper::getChildrenSelectSQL | ( | $oid, | |
$compositionOnly = false |
|||
) |
Get the SQL commands to select the objects children from the database.
oid | The object id of the object to load the children for. |
compositionOnly | True/False indicates wether to only select composition children or all [default: false]. |
Definition at line 780 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by appendChildData(), and deleteImpl().
RDBMapper::getChildrenDisassociateSQL | ( | $oid, | |
$sharedOnly = false |
|||
) |
Get the SQL command to disassociate the objects children from the object (e.g. setting the foreign key to null).
oid | The object id of the object to disassociate the children from. |
sharedOnly | True/False indicates wether to only disassociate shared children or all [default: false]. |
Definition at line 791 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by deleteImpl().
RDBMapper::getInsertSQL | ( | & | $object | ) |
Get the SQL command to insert a object into the database.
object | A reference to the object to insert. |
Definition at line 801 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by saveImpl().
RDBMapper::getUpdateSQL | ( | & | $object | ) |
Get the SQL command to update a object in the database.
object | A reference to the object to update. |
Definition at line 811 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by saveImpl().
RDBMapper::getDeleteSQL | ( | $oid | ) |
Get the SQL command to delete a object from the database.
oid | The object id of the object to delete. |
Definition at line 821 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by deleteImpl().
RDBMapper::createPKCondition | ( | $oid | ) |
Create a condition string for the primary key values of the form id1=val1, id2=val2, ...
oid | The object id that defines the primary key values |
Definition at line 831 of file class.RDBMapper.php.
References WCMFException\throwEx().
Referenced by loadImpl().
RDBMapper::$_connParams = null |
Definition at line 38 of file class.RDBMapper.php.
RDBMapper::$_conn = null |
Definition at line 39 of file class.RDBMapper.php.
Referenced by getConnection().
RDBMapper::$_dbPrefix = '' |
Definition at line 40 of file class.RDBMapper.php.
RDBMapper::$_idSelectStmt = null |
Definition at line 43 of file class.RDBMapper.php.
RDBMapper::$_idInsertStmt = null |
Definition at line 44 of file class.RDBMapper.php.
RDBMapper::$_idUpdateStmt = null |
Definition at line 45 of file class.RDBMapper.php.