wcmf logo wemove logo

PersistenceMapper Class Reference
[Persistence]

PersistenceMapper is the base class for all mapper classes. More...

Inheritance diagram for PersistenceMapper:

Inheritance graph
[legend]

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)
 startTransaction ()
 commitTransaction ()
 rollbackTransaction ()

Data Fields

 $_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-2009 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 929 2009-02-22 23:20:49Z iherwig

Author:
ingo herwig <ingo@wemove.com>

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


Member Function Documentation

getType (  ) 

Get the mapper type.

Returns:
Mapper type.

Reimplemented in RDBMapper, AdodbseqRDBMapper, LocktableRDBMapper, NMUserRoleRDBMapper, RoleRDBRDBMapper, and UserRDBRDBMapper.

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

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).

Reimplemented in NodeXMLDBMapper, AdodbseqRDBMapper, LocktableRDBMapper, NMUserRoleRDBMapper, RoleRDBRDBMapper, and UserRDBRDBMapper.

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

References WCMFException::throwEx().

Referenced by NodeUnifiedRDBMapper::getPKColumnNames().

Here is the call graph for this function:

setDataConverter ( dataConverter  ) 

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

Parameters:
dataConverter The DataConverter object.

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

getDataConverter (  ) 

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

Returns:
The DataConverter object.

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

enableLogging ( logStrategy  ) 

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

Parameters:
logStrategy The OutputStrategy to use.

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

disableLogging (  ) 

Disable logging.

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

isLogging (  ) 

Check if the PersistenceMapper is logging.

Returns:
True/False whether the PersistenceMapper is logging.

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

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

logAction ( &$  obj  ) 

Log action if logging is enabled.

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

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

References isLogging().

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

Here is the call graph for this function:

& load ( oid,
buildDepth,
buildAttribs = null,
buildTypes = null 
)

Load an object from the database.

Parameters:
oid OID of the object to construct
buildDepth One of the BUILDDEPTH constants or a number describing the number of generations to build (except BUILDDEPTH_REQUIRED)
buildAttribs An 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
buildTypes An 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.

Reimplemented in NodeToSingleTableMapper.

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

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

Here is the call graph for this function:

& create ( type,
buildDepth,
buildAttribs = null 
)

Construct the template of an Object of a given type.

Parameters:
type The type of object to build
buildDepth One of the BUILDDEPTH constants or a number describing the number of generations to build
buildAttribs An 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 150 of file class.PersistenceMapper.php.

References createImpl(), and initialize().

Here is the call graph for this function:

save ( &$  object  ) 

Save an Object to the persistent storage.

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

Reimplemented in NodeToSingleTableMapper, and NodeXMLMapper.

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

References authorizationFailedError(), checkAuthorization(), and saveImpl().

Here is the call graph for this function:

delete ( oid,
recursive = true 
)

Delete an Object from the persistent storage.

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

Reimplemented in NodeToSingleTableMapper, and NodeXMLMapper.

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

References authorizationFailedError(), checkAuthorization(), deleteImpl(), and isValidOID().

Here is the call graph for this function:

checkAuthorization ( oid,
action 
)

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

Parameters:
oid The object id of the Object to authorize (its type will be checked too)
action Action to authorize
Returns:
True/False depending on success of authorization

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

References RightsManager::getInstance().

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

Here is the call graph for this function:

authorizationFailedError ( oid,
action 
)

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

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

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

Here is the call graph for this function:

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:
object A reference to the object

Reimplemented in NodeUnifiedRDBMapper.

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

Referenced by create(), and load().

isValidOID ( oid  ) 

Validate a given OID.

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

Reimplemented in NodeUnifiedRDBMapper, and TableUnifiedRDBMapper.

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

References WCMFException::throwEx().

Referenced by delete(), and load().

Here is the call graph for this function:

& 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

Reimplemented in NodeXMLDBMapper, and RDBMapper.

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

References WCMFException::throwEx().

Referenced by load().

Here is the call graph for this function:

& 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

Reimplemented in NodeXMLDBMapper, and RDBMapper.

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

References WCMFException::throwEx().

Referenced by create().

Here is the call graph for this function:

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

Reimplemented in NodeXMLDBMapper, and RDBMapper.

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

References WCMFException::throwEx().

Referenced by save().

Here is the call graph for this function:

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

Reimplemented in NodeXMLDBMapper, and RDBMapper.

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

References WCMFException::throwEx().

Referenced by delete().

Here is the call graph for this function:

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

Reimplemented in NodeXMLDBMapper, and RDBMapper.

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

References WCMFException::throwEx().

Here is the call graph for this function:

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

Reimplemented in NodeXMLDBMapper.

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

References WCMFException::throwEx().

Here is the call graph for this function:

startTransaction (  ) 

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

Reimplemented in NodeXMLDBMapper, RDBMapper, and NodeXMLMapper.

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

commitTransaction (  ) 

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

Reimplemented in NodeXMLDBMapper, RDBMapper, and NodeXMLMapper.

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

rollbackTransaction (  ) 

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

Reimplemented in NodeXMLDBMapper, RDBMapper, and NodeXMLMapper.

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


Field Documentation

$_dataConverter = null

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

$_type = ''

Reimplemented in NodeToSingleTableMapper.

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

$_logging = false

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

$_logStrategy = null

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


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

This page generated via doxygen 1.5.8 Mon Mar 30 01:58:45 2009.
Copyright © 2009 wemove digital solutions GmbH.
sourceforge logo