Detailed Description

NodeUnifiedRDBMapper maps Node objects to a relational database schema where each Node type has its own table.

The wCMFGenerator uses this class as base class for all mappers.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 42 of file NodeUnifiedRDBMapper.php.

+ Inheritance diagram for NodeUnifiedRDBMapper:

Public Member Functions

 getSelectSQL ($criteria=null, $alias=null, $attributes=null, $orderby=null, PagingInfo $pagingInfo=null, $queryId=null)
 
 isForeignKey ($name)
 
- Public Member Functions inherited from AbstractRDBMapper
 __construct (PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ConcurrencyManager $concurrencyManager, EventManager $eventManager)
 
 __destruct ()
 
 __sleep ()
 
 setConnectionParams ($params)
 
 getConnectionParams ()
 
 getConnection ()
 
 getAdapter ()
 
 getQuoteIdentifierSymbol ()
 
 quoteIdentifier ($identifier)
 
 quoteValue ($value)
 
 getRealTableName ()
 
 executeSql ($sql, $parameters=[])
 
 select (SelectStatement $selectStmt, PagingInfo $pagingInfo=null)
 
 executeOperation (PersistenceOperation $operation)
 
 getRelations ($hierarchyType='all')
 
 getAttributes (array $tags=[], $matchMode='all')
 
 isSortable ($roleName=null)
 
 getSortkey ($roleName=null)
 
 getDefaultOrder ($roleName=null)
 
 constructOID ($data)
 
 renderCriteria (Criteria $criteria, $placeholder=null, $tableName=null, $columnName=null)
 
 loadObjectsFromSQL (SelectStatement $selectStmt, $buildDepth=BuildDepth::SINGLE, PagingInfo $pagingInfo=null, &$originalData=null)
 
 handleDbEvent ($e)
 
 beginTransaction ()
 
 commitTransaction ()
 
 rollbackTransaction ()
 
 getStatements ()
 
- Public Member Functions inherited from AbstractMapper
 setLogStrategy (OutputStrategy $logStrategy)
 
 getTypeDisplayName (Message $message)
 
 getTypeDescription (Message $message)
 
 hasRelation ($roleName)
 
 getRelation ($roleName)
 
 getRelationsByType ($type)
 
 hasAttribute ($name)
 
 getAttribute ($name)
 
 getReferences ()
 
 getAttributeDisplayName ($name, Message $message)
 
 getAttributeDescription ($name, Message $message)
 
 getProperties ()
 
 load (ObjectId $oid, $buildDepth=BuildDepth::SINGLE)
 
 create ($type, $buildDepth=BuildDepth::SINGLE)
 
 save (PersistentObject $object)
 
 delete (PersistentObject $object)
 
 getOIDs ($type, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 loadObjects ($type, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 loadRelation (array $objects, $role, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
- Public Member Functions inherited from PersistenceMapper
 getType ()
 
 getPkNames ()
 

Public Attributes

const CACHE_KEY = 'mapper'
 
- Public Attributes inherited from AbstractRDBMapper
const SEQUENCE_CLASS = 'DBSequence'
 
const INTERNAL_VALUE_PREFIX = '_mapper_internal_'
 

Protected Member Functions

 prepareForStorage (PersistentObject $object)
 
 getRelationSelectSQL (array $otherObjectProxies, $otherRole, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 getManyToOneRelationSelectSQL (RelationDescription $relationDescription, array $otherObjectProxies, $otherRole, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 getOneToManyRelationSelectSQL (RelationDescription $relationDescription, array $otherObjectProxies, $otherRole, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 getRelationStatement ($thisAttr, $parameters, array $otherObjectProxies, $otherRole, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 getManyToManyRelationSelectSQL (RelationDescription $relationDescription, array $otherObjectProxies, $otherRole, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 getInsertSQL (PersistentObject $object)
 
 getUpdateSQL (PersistentObject $object)
 
 getDeleteSQL (ObjectId $oid)
 
 addColumns (SelectStatement $selectStmt, $tableName, $attributes=null)
 
 addReferences (SelectStatement $selectStmt, $tableName)
 
 addCriteria (SelectStatement $selectStmt, $criteria, $tableName)
 
 addOrderBy (SelectStatement $selectStmt, $orderby, $orderType, $aliasName, $defaultOrder)
 
 getParameters ($criteria, $tableName)
 
 getPersistentValues (PersistentObject $object)
 
 convertValuesForStorage ($values)
 
 getSortableObject (PersistentObjectProxy $objectProxy, PersistentObjectProxy $relativeProxy, RelationDescription $relationDesc)
 
 loadRelationObjects (PersistentObjectProxy $objectProxy, PersistentObjectProxy $relativeProxy, RDBManyToManyRelationDescription $relationDesc, $includeTransaction=false)
 
 createPKCondition (ObjectId $oid)
 
 getForeignKeyRelations ()
 
 getCacheKey ($alias, $attributeArray, $criteriaArray, $orderArray, PagingInfo $pagingInfo=null)
 
- Protected Member Functions inherited from AbstractRDBMapper
 getSequenceMapper ()
 
 getNextId ()
 
 getRelationIncludingNM ($roleName)
 
 isPkValue ($name)
 
 loadImpl (ObjectId $oid, $buildDepth=BuildDepth::SINGLE)
 
 createImpl ($type, $buildDepth=BuildDepth::SINGLE)
 
 saveImpl (PersistentObject $object)
 
 deleteImpl (PersistentObject $object)
 
 getOIDsImpl ($type, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 loadObjectsImpl ($type, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 loadObjectsFromQueryParts ($type, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 createObjectFromData (array $data)
 
 convertValueFromStorage ($valueName, $value)
 
 addRelatedObjects (array $objects, $buildDepth=BuildDepth::SINGLE)
 
 loadRelationImpl (array $objects, $role, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 setIsInTransaction ($isInTransaction)
 
 isInTransaction ()
 
 getOwnDefaultOrder ($roleName=null)
 
 getRelationDescriptions ()
 
 getAttributeDescriptions ()
 
 createObject (ObjectId $oid=null)
 
 getTableName ()
 
- Protected Member Functions inherited from AbstractMapper
 logAction (PersistentObject $obj)
 
 checkAuthorization ($resource, $action)
 
 authorizationFailedError ($resource, $action)
 

Additional Inherited Members

- Static Protected Member Functions inherited from AbstractRDBMapper
static getMapper ($type, $strict=true)
 
- Protected Attributes inherited from AbstractMapper
 $persistenceFacade = null
 
 $permissionManager = null
 
 $concurrencyManager = null
 
 $eventManager = null
 

Member Function Documentation

◆ prepareForStorage()

prepareForStorage ( PersistentObject  $object)
protected
See also
RDBMapper::prepareForStorage()

Reimplemented from AbstractRDBMapper.

Definition at line 51 of file NodeUnifiedRDBMapper.php.

◆ getSelectSQL()

getSelectSQL (   $criteria = null,
  $alias = null,
  $attributes = null,
  $orderby = null,
PagingInfo  $pagingInfo = null,
  $queryId = null 
)
See also
RDBMapper::getSelectSQL()

Reimplemented from AbstractRDBMapper.

Definition at line 233 of file NodeUnifiedRDBMapper.php.

◆ getRelationSelectSQL()

getRelationSelectSQL ( array  $otherObjectProxies,
  $otherRole,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
protected
See also
RDBMapper::getRelationSelectSQL()

Reimplemented from AbstractRDBMapper.

Definition at line 284 of file NodeUnifiedRDBMapper.php.

◆ getManyToOneRelationSelectSQL()

getManyToOneRelationSelectSQL ( RelationDescription  $relationDescription,
array  $otherObjectProxies,
  $otherRole,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
protected

Get the statement for selecting a many-to-one relation.

See also
RDBMapper::getRelationSelectSQL()

Definition at line 306 of file NodeUnifiedRDBMapper.php.

◆ getOneToManyRelationSelectSQL()

getOneToManyRelationSelectSQL ( RelationDescription  $relationDescription,
array  $otherObjectProxies,
  $otherRole,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
protected

Get the statement for selecting a one-to-many relation.

See also
RDBMapper::getRelationSelectSQL()

Definition at line 333 of file NodeUnifiedRDBMapper.php.

◆ getRelationStatement()

getRelationStatement (   $thisAttr,
  $parameters,
array  $otherObjectProxies,
  $otherRole,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
protected

Get the select statement for a many-to-one or one-to-many relation.

This method is the common part used in both relations.

See also
RDBMapper::getRelationSelectSQL()

Definition at line 362 of file NodeUnifiedRDBMapper.php.

◆ getManyToManyRelationSelectSQL()

getManyToManyRelationSelectSQL ( RelationDescription  $relationDescription,
array  $otherObjectProxies,
  $otherRole,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
protected

Get the statement for selecting a many-to-many relation.

See also
RDBMapper::getRelationSelectSQL()

Definition at line 402 of file NodeUnifiedRDBMapper.php.

◆ getInsertSQL()

getInsertSQL ( PersistentObject  $object)
protected
See also
RDBMapper::getInsertSQL()

Reimplemented from AbstractRDBMapper.

Definition at line 478 of file NodeUnifiedRDBMapper.php.

◆ getUpdateSQL()

getUpdateSQL ( PersistentObject  $object)
protected
See also
RDBMapper::getUpdateSQL()

Reimplemented from AbstractRDBMapper.

Definition at line 491 of file NodeUnifiedRDBMapper.php.

◆ getDeleteSQL()

getDeleteSQL ( ObjectId  $oid)
protected
See also
RDBMapper::getDeleteSQL()

Reimplemented from AbstractRDBMapper.

Definition at line 507 of file NodeUnifiedRDBMapper.php.

◆ addColumns()

addColumns ( SelectStatement  $selectStmt,
  $tableName,
  $attributes = null 
)
protected

Add the columns to a given select statement.

Parameters
$selectStmtThe select statement (instance of SelectStatement)
$tableNameThe table name
$attributesArray of attribute names (optional)
Returns
SelectStatement

Definition at line 524 of file NodeUnifiedRDBMapper.php.

◆ addReferences()

addReferences ( SelectStatement  $selectStmt,
  $tableName 
)
protected

Add the columns and joins to select references to a given select statement.

Parameters
$selectStmtThe select statement (instance of SelectStatement)
$tableNameThe name for this table (the alias, if used).
Returns
SelectStatement

Definition at line 547 of file NodeUnifiedRDBMapper.php.

◆ addCriteria()

addCriteria ( SelectStatement  $selectStmt,
  $criteria,
  $tableName 
)
protected

Add the given criteria to the select statement.

Parameters
$selectStmtThe select statement (instance of SelectStatement)
$criteriaAn array of Criteria instances that define conditions on the object's attributes (maybe null)
$tableNameThe table name
Returns
Array of placeholder/value pairs

Definition at line 613 of file NodeUnifiedRDBMapper.php.

◆ addOrderBy()

addOrderBy ( SelectStatement  $selectStmt,
  $orderby,
  $orderType,
  $aliasName,
  $defaultOrder 
)
protected

Add the given order to the select statement.

Parameters
$selectStmtThe select statement (instance of SelectStatement)
$orderbyAn array holding names of attributes to order by, maybe appended with 'ASC', 'DESC' (maybe null)
$orderTypeThe type that define the attributes in orderby (maybe null)
$aliasNameThe table alias name to be used (maybe null)
$defaultOrderThe default order definition to use, if orderby is null (
See also
PersistenceMapper::getDefaultOrder())

Definition at line 648 of file NodeUnifiedRDBMapper.php.

◆ getParameters()

getParameters (   $criteria,
  $tableName 
)
protected

Get an array of placeholder/value pairs.

Parameters
$criteriaAn array of Criteria instances that define conditions on the object's attributes (maybe null)
$tableNameThe table name
Returns
Array of placeholder/value pairs

Definition at line 696 of file NodeUnifiedRDBMapper.php.

◆ getPersistentValues()

getPersistentValues ( PersistentObject  $object)
protected

Get an associative array of attribute name-value pairs to be stored for a given oject (references are not included)

Parameters
$objectThe PeristentObject.
Returns
Associative array

Definition at line 727 of file NodeUnifiedRDBMapper.php.

◆ convertValuesForStorage()

convertValuesForStorage (   $values)
protected

Convert values before putting into storage.

Parameters
$valuesAssociative Array
Returns
Associative Array

Definition at line 749 of file NodeUnifiedRDBMapper.php.

◆ getSortableObject()

getSortableObject ( PersistentObjectProxy  $objectProxy,
PersistentObjectProxy  $relativeProxy,
RelationDescription  $relationDesc 
)
protected

Get the object which carries the sortkey in the relation of the given object and relative.

Parameters
PersistentObjectProxy$objectProxy
PersistentObjectProxy$relativeProxy
RelationDescription$relationDescThe relation description
Returns
PersistentObjectProxy

Definition at line 774 of file NodeUnifiedRDBMapper.php.

◆ loadRelationObjects()

loadRelationObjects ( PersistentObjectProxy  $objectProxy,
PersistentObjectProxy  $relativeProxy,
RDBManyToManyRelationDescription  $relationDesc,
  $includeTransaction = false 
)
protected

Load the relation objects in a many to many relation from the database.

Parameters
$objectProxyThe proxy at this end of the relation.
$relativeProxyThe proxy at the other end of the relation.
$relationDescThe RDBManyToManyRelationDescription instance describing the relation.
$includeTransactionBoolean whether to also search in the current transaction (default: false)
Returns
Array of PersistentObject instances

Definition at line 792 of file NodeUnifiedRDBMapper.php.

◆ createPKCondition()

createPKCondition ( ObjectId  $oid)
protected
See also
RDBMapper::createPKCondition()

Reimplemented from AbstractRDBMapper.

Definition at line 831 of file NodeUnifiedRDBMapper.php.

◆ getForeignKeyRelations()

getForeignKeyRelations ( )
protected

Get all foreign key relations (used to reference a parent)

Returns
An array of RDBManyToOneRelationDescription instances

Definition at line 847 of file NodeUnifiedRDBMapper.php.

◆ isForeignKey()

isForeignKey (   $name)

Check if a given attribute is a foreign key (used to reference a parent)

Parameters
$nameThe attribute name
Returns
Boolean
Note
Public in order to be callable by ObjectQuery

Reimplemented from AbstractRDBMapper.

Definition at line 866 of file NodeUnifiedRDBMapper.php.

◆ getCacheKey()

getCacheKey (   $alias,
  $attributeArray,
  $criteriaArray,
  $orderArray,
PagingInfo  $pagingInfo = null 
)
protected

Get a unique string for the given parameter values.

Parameters
$alias
$attributeArray
$criteriaArray
$orderArray
$pagingInfo
Returns
String

Definition at line 885 of file NodeUnifiedRDBMapper.php.

Member Data Documentation

◆ CACHE_KEY

const CACHE_KEY = 'mapper'

Definition at line 44 of file NodeUnifiedRDBMapper.php.