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

Public Member Functions

 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

 $_dataConverter = null
 
 $_type = ''
 
 $_logging = false
 
 $_logStrategy = null
 

Detailed Description

PersistenceMapper is the base class for all mapper classes.

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.PersistenceMapper.php 1462 2014-02-04 23:52:27Z iherwig
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 33 of file class.PersistenceMapper.php.

Member Function Documentation

PersistenceMapper::getType ( )

Get the mapper type.

Returns
Mapper type.

Definition at line 44 of file class.PersistenceMapper.php.

References $_type.

PersistenceMapper::getPkNames ( )

Get the names of the primary key values.

Returns
An associative array with the value names as keys and the types as values (see PersistentObject::getValue).

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

References WCMFException\throwEx().

Referenced by NodeUnifiedRDBMapper\getPKColumnNames().

+ Here is the call graph for this function:

PersistenceMapper::setDataConverter (   $dataConverter)

Set the DataConverter that should be used on load() and save().

Parameters
dataConverterThe DataConverter object.

Definition at line 60 of file class.PersistenceMapper.php.

PersistenceMapper::getDataConverter ( )

Get the DataConverter that is used on load() and save().

Returns
The DataConverter object.

Definition at line 68 of file class.PersistenceMapper.php.

References $_dataConverter.

PersistenceMapper::enableLogging (   $logStrategy)

Enable logging using a given OutputStrategy to log insert/update/delete actions to a file.

Parameters
logStrategyThe OutputStrategy to use.

Definition at line 76 of file class.PersistenceMapper.php.

PersistenceMapper::disableLogging ( )

Disable logging.

Definition at line 84 of file class.PersistenceMapper.php.

PersistenceMapper::isLogging ( )

Check if the PersistenceMapper is logging.

Returns
True/False whether the PersistenceMapper is logging.

Definition at line 92 of file class.PersistenceMapper.php.

References $_logging.

Referenced by NodeToSingleTableMapper\delete(), NodeXMLDBMapper\deleteImpl(), RDBMapper\deleteImpl(), and logAction().

PersistenceMapper::logAction ( $obj)

Log action if logging is enabled.

Note
Subclasses must call this method in save/delete method in appropriate place.
Parameters
objThe object on which the action is performed on.

Definition at line 101 of file class.PersistenceMapper.php.

References isLogging().

Referenced by NodeToSingleTableMapper\delete(), NodeXMLDBMapper\deleteImpl(), RDBMapper\deleteImpl(), NodeToSingleTableMapper\save(), NodeXMLDBMapper\saveImpl(), and RDBMapper\saveImpl().

+ Here is the call graph for this function:

& PersistenceMapper::load (   $oid,
  $buildDepth,
  $buildAttribs = null,
  $buildTypes = null 
)

Load an object from the database.

Parameters
oidOID of the object to construct
buildDepthOne of the BUILDDEPTH constants or a number describing the number of generations to build (except BUILDDEPTH_REQUIRED)
buildAttribsAn assoziative array listing the attributes to load (default: null loads all attributes) (keys: the types, values: an array of attributes of the type to load) Use this to load only a subset of attributes
buildTypesAn array listing the (sub-)types to include
Returns
A reference to the object, null if oid does not exist or a given condition prevents loading.

Definition at line 116 of file class.PersistenceMapper.php.

References ACTION_MODIFY, ACTION_READ, authorizationFailedError(), checkAuthorization(), initialize(), isValidOID(), and loadImpl().

+ Here is the call graph for this function:

& PersistenceMapper::create (   $type,
  $buildDepth,
  $buildAttribs = null 
)

Construct the template of an Object of a given type.

Parameters
typeThe type of object to build
buildDepthOne of the BUILDDEPTH constants or a number describing the number of generations to build
buildAttribsAn assoziative array listing the attributes to create (default: null creates all attributes) (keys: the types, values: an array of attributes of the type to create) Use this to create only a subset of attributes
Returns
A reference to the object.

Definition at line 151 of file class.PersistenceMapper.php.

References createImpl(), and initialize().

+ Here is the call graph for this function:

PersistenceMapper::save ( $object)

Save an Object to the persistent storage.

Parameters
objectA reference to the object to safe
Returns
True/False depending on success of operation

Definition at line 170 of file class.PersistenceMapper.php.

References ACTION_CREATE, ACTION_MODIFY, authorizationFailedError(), checkAuthorization(), saveImpl(), STATE_DIRTY, and STATE_NEW.

+ Here is the call graph for this function:

PersistenceMapper::delete (   $oid,
  $recursive = true 
)

Delete an Object from the persistent storage.

Parameters
oidThe object id of the Object to delete
recursiveTrue/False whether to physically delete it's children too [default: true]
Returns
True/False depending on success of operation

Definition at line 192 of file class.PersistenceMapper.php.

References ACTION_DELETE, authorizationFailedError(), checkAuthorization(), deleteImpl(), LockManager\getInstance(), and isValidOID().

+ Here is the call graph for this function:

PersistenceMapper::checkAuthorization (   $oid,
  $action 
)

Check authorization on an type/OID and a given action.

Parameters
oidThe object id of the Object to authorize (its type will be checked too)
actionAction to authorize
Returns
True/False depending on success of authorization

Definition at line 219 of file class.PersistenceMapper.php.

References RightsManager\getInstance().

Referenced by delete(), load(), and save().

+ Here is the call graph for this function:

PersistenceMapper::authorizationFailedError (   $oid,
  $action 
)

Definition at line 227 of file class.PersistenceMapper.php.

References ACTION_READ, Log\error(), Message\get(), WCMFException\getStackTrace(), and WCMFException\throwEx().

Referenced by delete(), load(), and save().

+ Here is the call graph for this function:

PersistenceMapper::initialize ( $object)

Initialize the object after creation/loading and before handing it over to the application.

Note
Subclasses may override this to implement special requirements (e.g. install listeners). Remember to always call parent::initialize().
Parameters
objectA reference to the object

Definition at line 242 of file class.PersistenceMapper.php.

Referenced by create(), and load().

PersistenceMapper::isValidOID (   $oid)

Validate a given OID.

Note
Subclasses must implement this method
Parameters
oidThe OID of the object.
Returns
An True/False whether the OID is valid

Definition at line 251 of file class.PersistenceMapper.php.

References WCMFException\throwEx().

Referenced by delete(), and load().

+ Here is the call graph for this function:

& PersistenceMapper::loadImpl (   $oid,
  $buildDepth,
  $buildAttribs = null,
  $buildTypes = null 
)
See Also
PersistenceFacade::load()
Note
Subclasses must implement the loading of an object from the storage in this method
Precondition: Object rights have been checked already

Definition at line 261 of file class.PersistenceMapper.php.

References WCMFException\throwEx().

Referenced by load().

+ Here is the call graph for this function:

& PersistenceMapper::createImpl (   $type,
  $buildDepth,
  $buildAttribs = null 
)
See Also
PersistenceFacade::create()
Note
Subclasses must implement the creation of an object in this method
Precondition: Object rights have been checked already

Definition at line 270 of file class.PersistenceMapper.php.

References WCMFException\throwEx().

Referenced by create().

+ Here is the call graph for this function:

PersistenceMapper::saveImpl ( $object)
See Also
PersistenceFacade::save()
Note
Subclasses must implement the modification of an object in the storage in this method
Precondition: Object rights have been checked already

Definition at line 279 of file class.PersistenceMapper.php.

References WCMFException\throwEx().

Referenced by save().

+ Here is the call graph for this function:

PersistenceMapper::deleteImpl (   $oid,
  $recursive = true 
)
See Also
PersistenceFacade::delete()
Note
Subclasses must implement the deletion of an object from the storage in this method
Precondition: Object rights have been checked already

Definition at line 288 of file class.PersistenceMapper.php.

References WCMFException\throwEx().

Referenced by delete().

+ Here is the call graph for this function:

PersistenceMapper::getOIDs (   $type,
  $criteria = null,
  $orderby = null,
$pagingInfo 
)
See Also
PersistenceFacade::getOIDs()
Note
Subclasses must implement the retrieval of object ids from the storage in this method

Definition at line 296 of file class.PersistenceMapper.php.

References WCMFException\throwEx().

+ Here is the call graph for this function:

PersistenceMapper::loadObjects (   $type,
  $buildDepth,
  $criteria = null,
  $orderby = null,
$pagingInfo,
  $buildAttribs = null,
  $buildTypes = null 
)
See Also
PersistenceFacade::loadObjects()
Note
Subclasses must implement the retrieval of objects from the storage in this method

Definition at line 304 of file class.PersistenceMapper.php.

References WCMFException\throwEx().

+ Here is the call graph for this function:

PersistenceMapper::getOrderBy ( )

Get the names of the attributes to order by, when retrieving the oids. ASC (ascending), DESC (descending) may be added to defined the order direction for each attribute.

Returns
An array of attribute names

Definition at line 313 of file class.PersistenceMapper.php.

References WCMFException\throwEx().

Referenced by NodeUnifiedRDBMapper\getSelectSQL().

+ Here is the call graph for this function:

PersistenceMapper::startTransaction ( )
See Also
PersistenceFacade::startTransaction()
Note
The default implementation does nothing. Subclasses may override this method if required

Definition at line 321 of file class.PersistenceMapper.php.

PersistenceMapper::commitTransaction ( )
See Also
PersistenceFacade::commitTransaction()
Note
The default implementation does nothing. Subclasses may override this method if required

Definition at line 328 of file class.PersistenceMapper.php.

PersistenceMapper::rollbackTransaction ( )
See Also
PersistenceFacade::rollbackTransaction()
Note
The default implementation does nothing. Subclasses may override this method if required

Definition at line 335 of file class.PersistenceMapper.php.

Member Data Documentation

PersistenceMapper::$_dataConverter = null

Definition at line 35 of file class.PersistenceMapper.php.

Referenced by getDataConverter().

PersistenceMapper::$_type = ''

Definition at line 36 of file class.PersistenceMapper.php.

Referenced by getType().

PersistenceMapper::$_logging = false

Definition at line 37 of file class.PersistenceMapper.php.

Referenced by isLogging().

PersistenceMapper::$_logStrategy = null

Definition at line 38 of file class.PersistenceMapper.php.


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