wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
NodeUnifiedRDBMapper Class Reference
+ Inheritance diagram for NodeUnifiedRDBMapper:

Public Member Functions

 initialize (&$object)
 
 prepareInsert (&$object)
 
 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)
 
 isAttribute ($name)
 
 isChild ($type, $childDef)
 
 getChildDef ($type, $childDef)
 
 isForeignKey ($column)
 
 getSQLForRefs ($nodeDef, $attribStr, $tableStr, $condStr, $orderStr, $attribs=null)
 
 translateAppToDatabase ($str)
 
 getColumnName ($attributeName, $dataType=null)
 
 getChildFKColumnName ($childType, $isRequired=true)
 
 getMyFKColumnName ($parentType, $isRequired=true)
 
 quote ($value)
 
 getPKColumnNames ()
 
 isValidOID ($oid)
 
 getId ()
 
 valueChanged (&$object, $name, $type, $oldValue, $newValue)
 
 propertyChanged (&$object, $name, $oldValue, $newValue)
 
 stateChanged (&$object, $oldValue, $newValue)
 
 getObjectDefinitionImpl ()
 
 getTableName ()
 
 getMyFKColumnNameImpl ($parentType)
 
- Public Member Functions inherited from NodeRDBMapper
createObject ($oid=null)
 
 appendObject (&$object, &$dependendObject)
 
 applyDataOnLoad (&$object, $objectData, $attribs)
 
 applyDataOnCreate (&$object, $objectData, $attribs)
 
 getObjectDefinition ()
 
- Public Member Functions inherited from RDBMapper
 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 ()
 

Additional Inherited Members

- Public Attributes inherited from RDBMapper
 $_connParams = null
 
 $_conn = null
 
 $_dbPrefix = ''
 
 $_idSelectStmt = null
 
 $_idInsertStmt = null
 
 $_idUpdateStmt = null
 
- Public Attributes inherited from PersistenceMapper
 $_dataConverter = null
 
 $_type = ''
 
 $_logging = false
 
 $_logStrategy = null
 

Detailed Description

NodeUnifiedRDBMapper maps Node objects to a relational database schema where each Node type has its own table. In comparison to NodeRDBMapper it implements almost all template methods from the base classes and defines the sql queries. The newly defined template methods make it easier for application developers to implement own mapper subclasses. The wCMFGenerator uses this class as base class for all mappers. Besides some methods that define table/column names, the main effort lies in implementing the getObjectDefinitionImpl() method wich needs the following extra definitions:

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.

Id:
class.NodeUnifiedRDBMapper.php 1462 2014-02-04 23:52:27Z iherwig
  • extra key _refs see NodeUnifiedRDBMapper::getObjectDefinitionImpl()
  • in _datadef array the following keys are added:
    • column_name The name of the database column
  • in _parents array the following keys are added:
    • is_navigable True/False wether the parent is navigable from this object or not
    • table_name The name of the database table of the parent
    • pk_columns An array of the name(s) of the primary key columns of the parent table
    • fk_columns The name of the foreign key column that point from the object's table to the parent table (compound foreign keys are not supported yet)
  • in _children array the following keys are added:
    • is_navigable True/False wether the child is navigable from this object or not
    • table_name The name of the database table
    • pk_columns An array of the name(s) of the primary key columns of the child table
    • fk_column The name of the foreign key column that point from the child table to the object's table (compound foreign keys are not supported yet)
    • order_by An array of columns to sort by default
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 52 of file class.NodeUnifiedRDBMapper.php.

Member Function Documentation

NodeUnifiedRDBMapper::initialize ( $object)
NodeUnifiedRDBMapper::prepareInsert ( $object)
NodeUnifiedRDBMapper::getObjectDefinition ( )
See Also
NodeRDBMapper::getObjectDefinition()

Definition at line 93 of file class.NodeUnifiedRDBMapper.php.

References DATATYPE_ATTRIBUTE, and getObjectDefinitionImpl().

Referenced by isAttribute().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getSelectSQL (   $condStr,
  $orderStr = null,
  $attribs = null,
  $asArray = false 
)
NodeUnifiedRDBMapper::getChildrenSelectSQL (   $oid,
  $compositionOnly = false 
)
See Also
NodeRDBMapper::getChildrenSelectSQL()

Definition at line 223 of file class.NodeUnifiedRDBMapper.php.

References getObjectDefinitionImpl(), PersistenceFacade\getOIDParameter(), and quote().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getChildrenDisassociateSQL (   $oid,
  $sharedOnly = false 
)
See Also
NodeRDBMapper::getChildrenDisassociateSQL()

Definition at line 244 of file class.NodeUnifiedRDBMapper.php.

References getObjectDefinitionImpl(), and PersistenceFacade\getOIDParameter().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getDeleteSQL (   $oid)
See Also
NodeRDBMapper::getDeleteSQL()

Definition at line 388 of file class.NodeUnifiedRDBMapper.php.

References createPKCondition().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::createPKCondition (   $oid)
See Also
NodeRDBMapper::createPKCondition()

Definition at line 402 of file class.NodeUnifiedRDBMapper.php.

References PersistenceFacade\getOIDParameter(), getPKColumnNames(), getTableName(), and quote().

Referenced by getDeleteSQL(), and getUpdateSQL().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::isAttribute (   $name)

Check if a given name is the name of a value

Parameters
nameThe name to check
Returns
True/False

Definition at line 420 of file class.NodeUnifiedRDBMapper.php.

References getObjectDefinition().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::isChild (   $type,
  $childDef 
)

Check if a given type is a child type

Parameters
typeThe type to check
childDefThe child array as defined in the _children key (see NodeRDBMapper::getObjectDefinition())
Returns
True/False

Definition at line 436 of file class.NodeUnifiedRDBMapper.php.

References getChildDef().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getChildDef (   $type,
  $childDef 
)

Get the definition of a given child type

Parameters
typeThe type to get the definition for
childDefThe child array as defined in the _children key (see NodeRDBMapper::getObjectDefinition())
Returns
The child definition or null if not found

Definition at line 446 of file class.NodeUnifiedRDBMapper.php.

Referenced by getSQLForRefs(), and isChild().

NodeUnifiedRDBMapper::isForeignKey (   $column)

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

Parameters
columnThe column name
Returns
True/False

Definition at line 460 of file class.NodeUnifiedRDBMapper.php.

References getObjectDefinitionImpl().

Referenced by getInsertSQL(), and prepareInsert().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getSQLForRefs (   $nodeDef,
  $attribStr,
  $tableStr,
  $condStr,
  $orderStr,
  $attribs = null 
)

Get the SQL strings for use for the referenced values based on the given strings

Parameters
nodeDefThe node definition array (see NodeRDBMapper::getObjectDefinition())
attribStrThe SQL attribute string to append to
tableStrThe SQL table string to append to
condStrThe SQL condition string to append to
orderStrThe SQL order string to append to
attribsThe attributes to select or null to select all
Returns
An assoziative array with the following keys 'attribStr', 'tableStr', 'condStr', 'orderStr' which hold the updated strings

Definition at line 482 of file class.NodeUnifiedRDBMapper.php.

References getChildDef(), getMyFKColumnName(), getPKColumnNames(), getTableName(), quote(), and StringUtil\removeTrailingComma().

Referenced by getSelectSQL().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::translateAppToDatabase (   $str)

Replace all attribute and type occurences to columns and table name

Parameters
strThe string to translate (e.g. an orderby clause)
Returns
The translated string

Definition at line 559 of file class.NodeUnifiedRDBMapper.php.

References getObjectDefinitionImpl(), getTableName(), and RDBMapper\getType().

Referenced by getSelectSQL().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getColumnName (   $attributeName,
  $dataType = null 
)

Get the name of a column

Parameters
attributeNameThe name of the corresponding attribute
dataTypeThe data type of the attribute
Returns
The name of the column or null if not existent

Definition at line 575 of file class.NodeUnifiedRDBMapper.php.

References getObjectDefinitionImpl(), RDBMapper\getType(), and WCMFException\throwEx().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getChildFKColumnName (   $childType,
  $isRequired = true 
)

Get the name of the foreign key column defined in a given child type that connects from that type to the primary key column of this type.

Parameters
childTypeThe child type
isRequiredTrue/False wether it is required to find a fk column or not
Returns
The name of the column

Definition at line 601 of file class.NodeUnifiedRDBMapper.php.

References getObjectDefinitionImpl(), and WCMFException\throwEx().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getMyFKColumnName (   $parentType,
  $isRequired = true 
)

Get the name of the foreign key column defined in this type that connects to the primary key column of a parent type.

Parameters
parentTypeThe parent type
isRequiredTrue/False wether it is required to find a fk column or not
Returns
The name of the column

Definition at line 621 of file class.NodeUnifiedRDBMapper.php.

References getMyFKColumnNameImpl(), and WCMFException\throwEx().

Referenced by getInsertSQL(), getSQLForRefs(), and getUpdateSQL().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::quote (   $value)

Quote a value to be inserted into the database

Parameters
valueThe value to quote
Returns
The quoted value

Definition at line 647 of file class.NodeUnifiedRDBMapper.php.

References RDBMapper\getConnection().

Referenced by createPKCondition(), getChildrenSelectSQL(), getInsertSQL(), getSelectSQL(), getSQLForRefs(), and getUpdateSQL().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getPKColumnNames ( )

Get the names of the primary key database columns of this type

Returns
An array of the names of the columns

Definition at line 661 of file class.NodeUnifiedRDBMapper.php.

References PersistenceMapper\getPkNames().

Referenced by createPKCondition(), getInsertSQL(), getSelectSQL(), getSQLForRefs(), and prepareInsert().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::isValidOID (   $oid)
See Also
PersistenceMapper::isValidOID()

Definition at line 668 of file class.NodeUnifiedRDBMapper.php.

References PersistenceFacade\decomposeOID(), and RDBMapper\getType().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getId ( )

ChangeListener interface implementation

See Also
ChangeListener::getId()

Definition at line 693 of file class.NodeUnifiedRDBMapper.php.

NodeUnifiedRDBMapper::valueChanged ( $object,
  $name,
  $type,
  $oldValue,
  $newValue 
)
NodeUnifiedRDBMapper::propertyChanged ( $object,
  $name,
  $oldValue,
  $newValue 
)
See Also
ChangeListener::propertyChanged()

Definition at line 704 of file class.NodeUnifiedRDBMapper.php.

References PersistenceFacade\decomposeOID(), and getObjectDefinitionImpl().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::stateChanged ( $object,
  $oldValue,
  $newValue 
)
NodeUnifiedRDBMapper::getObjectDefinitionImpl ( )

TEMPLATE METHODS Subclasses must implement this method to define their object type. Implementation of NodeRDBMapper::getObjectDefinition()

Note
Subclasses must implement this method to define their Node type.
NodeUnifiedRDBMapper enhances the node definition array by optional references, which may be noted in the following key:
  • _refs: An array of assoziative arrays with the keys 'name', 'ref_type', 'ref_value', 'ref_table', 'id_column', 'fk_columns', 'ref_column' for every referenced data item. With these definitions it is possible to reference values (ref_value) from other types (ref_type) (e.g. array('name' => 'employee_name', 'ref_type' => 'Employee', 'ref_value' => 'name', 'ref_table' => 'Employee', 'id_column' => 'id', 'fk_columns' => 'fk_company_id', 'ref_colmn' => 'employee_name'))
Note
A type can only reference values from a type to which it is directly connected!

Definition at line 747 of file class.NodeUnifiedRDBMapper.php.

References WCMFException\throwEx().

Referenced by getChildFKColumnName(), getChildrenDisassociateSQL(), getChildrenSelectSQL(), getColumnName(), getInsertSQL(), getObjectDefinition(), getSelectSQL(), getUpdateSQL(), isForeignKey(), propertyChanged(), and translateAppToDatabase().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getTableName ( )

Get the name of the database table, where this type is mapped to

Returns
The name of the table

Definition at line 755 of file class.NodeUnifiedRDBMapper.php.

References WCMFException\throwEx().

Referenced by createPKCondition(), getInsertSQL(), getSelectSQL(), getSQLForRefs(), getUpdateSQL(), and translateAppToDatabase().

+ Here is the call graph for this function:

NodeUnifiedRDBMapper::getMyFKColumnNameImpl (   $parentType)

Get the name of the foreign key column defined in this type that connects to the primary key column of a parent type.

Parameters
parentTypeThe parent type
Returns
The name of the column

Definition at line 765 of file class.NodeUnifiedRDBMapper.php.

References WCMFException\throwEx().

Referenced by getMyFKColumnName().

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: