Detailed Description

AbstractMapper provides a basic implementation for other mapper classes.

It handles authorization on entity level and calls the lifecycle callcacks of PersistentObject instances. Authorization on attribute level has to be implemented by subclasses.

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

Definition at line 38 of file AbstractMapper.php.

+ Inheritance diagram for AbstractMapper:

Public Member Functions

 __construct (PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ConcurrencyManager $concurrencyManager, EventManager $eventManager)
 
 setLogStrategy (OutputStrategy $logStrategy)
 
 hasRelation ($roleName)
 
 hasAttribute ($name)
 
 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 ()
 
 getTypeDisplayName (Message $message)
 
 getTypeDescription (Message $message)
 
 getPkNames ()
 
 getQuoteIdentifierSymbol ()
 
 quoteIdentifier ($identifier)
 
 quoteValue ($value)
 
 getRelations ($hierarchyType='all')
 
 getRelation ($roleName)
 
 getRelationsByType ($type)
 
 getAttributes (array $tags=[], $matchMode='all')
 
 getAttribute ($name)
 
 getAttributeDisplayName ($name, Message $message)
 
 getAttributeDescription ($name, Message $message)
 
 getProperties ()
 
 isSortable ($roleName=null)
 
 getSortkey ($roleName=null)
 
 getDefaultOrder ($roleName=null)
 
 executeOperation (PersistenceOperation $operation)
 
 beginTransaction ()
 
 commitTransaction ()
 
 rollbackTransaction ()
 

Protected Member Functions

 logAction (PersistentObject $obj)
 
 checkAuthorization ($resource, $action)
 
 authorizationFailedError ($resource, $action)
 
 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)
 
 loadRelationImpl (array $objects, $role, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 

Protected Attributes

 $persistenceFacade = null
 
 $permissionManager = null
 
 $concurrencyManager = null
 
 $eventManager = null
 

Constructor & Destructor Documentation

__construct ( PersistenceFacade  $persistenceFacade,
PermissionManager  $permissionManager,
ConcurrencyManager  $concurrencyManager,
EventManager  $eventManager 
)

Constructor.

Parameters
$persistenceFacade
$permissionManager
$concurrencyManager
$eventManager

Definition at line 59 of file AbstractMapper.php.

Member Function Documentation

setLogStrategy ( OutputStrategy  $logStrategy)

Set the OutputStrategy used for logging persistence actions.

Parameters
$logStrategy

Definition at line 76 of file AbstractMapper.php.

hasRelation (   $roleName)
See also
PersistenceMapper::hasRelation()

Implements PersistenceMapper.

Definition at line 83 of file AbstractMapper.php.

hasAttribute (   $name)
See also
PersistenceMapper::hasAttribute()

Implements PersistenceMapper.

Definition at line 101 of file AbstractMapper.php.

load ( ObjectId  $oid,
  $buildDepth = BuildDepth::SINGLE 
)
See also
PersistenceMapper::load()

Implements PersistenceMapper.

Definition at line 119 of file AbstractMapper.php.

create (   $type,
  $buildDepth = BuildDepth::SINGLE 
)
See also
PersistenceMapper::create()

Implements PersistenceMapper.

Definition at line 140 of file AbstractMapper.php.

save ( PersistentObject  $object)
See also
PersistenceMapper::save()

Implements PersistenceMapper.

Definition at line 156 of file AbstractMapper.php.

delete ( PersistentObject  $object)
See also
PersistenceMapper::delete()

Implements PersistenceMapper.

Definition at line 214 of file AbstractMapper.php.

getOIDs (   $type,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
See also
PersistenceMapper::getOIDs()

Implements PersistenceMapper.

Definition at line 247 of file AbstractMapper.php.

loadObjects (   $type,
  $buildDepth = BuildDepth::SINGLE,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
See also
PersistenceMapper::loadObjects()

Implements PersistenceMapper.

Definition at line 268 of file AbstractMapper.php.

loadRelation ( array  $objects,
  $role,
  $buildDepth = BuildDepth::SINGLE,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
See also
PersistenceMapper::loadRelation()

Implements PersistenceMapper.

Definition at line 294 of file AbstractMapper.php.

logAction ( PersistentObject  $obj)
protected

Log the state of the given object.

Parameters
$objPersistentObject instance

Definition at line 324 of file AbstractMapper.php.

checkAuthorization (   $resource,
  $action 
)
protected

Check authorization on a resource (type/instance/instance property) and a given action.

Parameters
$resourceResource to authorize
$actionAction to authorize
Returns
Boolean depending on success of authorization

Definition at line 336 of file AbstractMapper.php.

authorizationFailedError (   $resource,
  $action 
)
protected

Handle an authorization error.

Parameters
$resource
$action
Exceptions
AuthorizationException

Definition at line 346 of file AbstractMapper.php.

loadImpl ( ObjectId  $oid,
  $buildDepth = BuildDepth::SINGLE 
)
abstractprotected
See also
PersistenceFacade::load()
Note
Precondition: Object rights have been checked already
createImpl (   $type,
  $buildDepth = BuildDepth::SINGLE 
)
abstractprotected
See also
PersistenceFacade::create()
Note
Precondition: Object rights have been checked already
saveImpl ( PersistentObject  $object)
abstractprotected
See also
PersistenceMapper::save()
Note
Precondition: Object rights have been checked already
deleteImpl ( PersistentObject  $object)
abstractprotected
See also
PersistenceMapper::delete()
Note
Precondition: Object rights have been checked already
getOIDsImpl (   $type,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
abstractprotected
loadObjectsImpl (   $type,
  $buildDepth = BuildDepth::SINGLE,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
abstractprotected
loadRelationImpl ( array  $objects,
  $role,
  $buildDepth = BuildDepth::SINGLE,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
abstractprotected

Member Data Documentation

$persistenceFacade = null
protected

Definition at line 47 of file AbstractMapper.php.

$permissionManager = null
protected

Definition at line 48 of file AbstractMapper.php.

$concurrencyManager = null
protected

Definition at line 49 of file AbstractMapper.php.

$eventManager = null
protected

Definition at line 50 of file AbstractMapper.php.