Detailed Description

AbstractMapper provides a basic implementation for other mapper classes.

It handles authorization on entity level and calls the lifecycle callbacks 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 41 of file AbstractMapper.php.

+ Inheritance diagram for AbstractMapper:

Public Member Functions

 __construct (PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ConcurrencyManager $concurrencyManager, EventManager $eventManager)
 
 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 ()
 
 getRelations ($hierarchyType='all')
 
 getAttributes (array $tags=[], $matchMode='all')
 
 isSortable ($roleName=null)
 
 getSortkey ($roleName=null)
 
 getDefaultOrder ($roleName=null)
 
 executeOperation (PersistenceOperation $operation)
 
 beginTransaction ()
 
 commitTransaction ()
 
 rollbackTransaction ()
 
 getStatements ()
 

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

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

Constructor.

Parameters
$persistenceFacade
$permissionManager
$concurrencyManager
$eventManager

Reimplemented in AbstractRDBMapper.

Definition at line 62 of file AbstractMapper.php.

Member Function Documentation

◆ setLogStrategy()

setLogStrategy ( OutputStrategy  $logStrategy)

Set the OutputStrategy used for logging persistence actions.

Parameters
$logStrategy

Definition at line 79 of file AbstractMapper.php.

◆ getTypeDisplayName()

getTypeDisplayName ( Message  $message)
See also
PersistenceMapper::getTypeDisplayName()

Implements PersistenceMapper.

Definition at line 86 of file AbstractMapper.php.

◆ getTypeDescription()

getTypeDescription ( Message  $message)
See also
PersistenceMapper::getTypeDescription()

Implements PersistenceMapper.

Definition at line 93 of file AbstractMapper.php.

◆ hasRelation()

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

Implements PersistenceMapper.

Definition at line 100 of file AbstractMapper.php.

◆ getRelation()

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

Implements PersistenceMapper.

Definition at line 108 of file AbstractMapper.php.

◆ getRelationsByType()

getRelationsByType (   $type)
See also
PersistenceMapper::getRelationsByType()

Implements PersistenceMapper.

Definition at line 118 of file AbstractMapper.php.

◆ hasAttribute()

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

Implements PersistenceMapper.

Definition at line 129 of file AbstractMapper.php.

◆ getAttribute()

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

Implements PersistenceMapper.

Definition at line 137 of file AbstractMapper.php.

◆ getReferences()

getReferences ( )
See also
PersistenceMapper::getReferences()

Implements PersistenceMapper.

Definition at line 147 of file AbstractMapper.php.

◆ getAttributeDisplayName()

getAttributeDisplayName (   $name,
Message  $message 
)

◆ getAttributeDescription()

getAttributeDescription (   $name,
Message  $message 
)

◆ getProperties()

getProperties ( )
See also
PersistenceMapper::getProperties()

Implements PersistenceMapper.

Definition at line 169 of file AbstractMapper.php.

◆ load()

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

Implements PersistenceMapper.

Definition at line 176 of file AbstractMapper.php.

◆ create()

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

Implements PersistenceMapper.

Definition at line 197 of file AbstractMapper.php.

◆ save()

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

Implements PersistenceMapper.

Definition at line 213 of file AbstractMapper.php.

◆ delete()

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

Implements PersistenceMapper.

Definition at line 271 of file AbstractMapper.php.

◆ getOIDs()

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

Implements PersistenceMapper.

Definition at line 304 of file AbstractMapper.php.

◆ loadObjects()

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

Implements PersistenceMapper.

Definition at line 325 of file AbstractMapper.php.

◆ loadRelation()

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

Implements PersistenceMapper.

Definition at line 351 of file AbstractMapper.php.

◆ logAction()

logAction ( PersistentObject  $obj)
protected

Log the state of the given object.

Parameters
$objPersistentObject instance

Definition at line 381 of file AbstractMapper.php.

◆ checkAuthorization()

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 393 of file AbstractMapper.php.

◆ authorizationFailedError()

authorizationFailedError (   $resource,
  $action 
)
protected

Handle an authorization error.

Parameters
$resource
$action
Exceptions
AuthorizationException

Definition at line 403 of file AbstractMapper.php.

◆ loadImpl()

loadImpl ( ObjectId  $oid,
  $buildDepth = BuildDepth::SINGLE 
)
abstractprotected
See also
PersistenceFacade::load()
Note
Precondition: Object rights have been checked already

Reimplemented in AbstractRDBMapper.

◆ createImpl()

createImpl (   $type,
  $buildDepth = BuildDepth::SINGLE 
)
abstractprotected
See also
PersistenceFacade::create()
Note
Precondition: Object rights have been checked already

Reimplemented in AbstractRDBMapper.

◆ saveImpl()

saveImpl ( PersistentObject  $object)
abstractprotected
See also
PersistenceMapper::save()
Note
Precondition: Object rights have been checked already

Reimplemented in AbstractRDBMapper.

◆ deleteImpl()

deleteImpl ( PersistentObject  $object)
abstractprotected
See also
PersistenceMapper::delete()
Note
Precondition: Object rights have been checked already

Reimplemented in AbstractRDBMapper.

◆ getOIDsImpl()

getOIDsImpl (   $type,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
abstractprotected

◆ loadObjectsImpl()

loadObjectsImpl (   $type,
  $buildDepth = BuildDepth::SINGLE,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
abstractprotected

◆ loadRelationImpl()

loadRelationImpl ( array  $objects,
  $role,
  $buildDepth = BuildDepth::SINGLE,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)
abstractprotected

Member Data Documentation

◆ $persistenceFacade

$persistenceFacade = null
protected

Definition at line 50 of file AbstractMapper.php.

◆ $permissionManager

$permissionManager = null
protected

Definition at line 51 of file AbstractMapper.php.

◆ $concurrencyManager

$concurrencyManager = null
protected

Definition at line 52 of file AbstractMapper.php.

◆ $eventManager

$eventManager = null
protected

Definition at line 53 of file AbstractMapper.php.