PersistenceFacade Interface Reference

Detailed Description

PersistenceFacade defines the interface for PersistenceFacade implementations.

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

Definition at line 23 of file PersistenceFacade.php.

+ Inheritance diagram for PersistenceFacade:

Public Member Functions

 getKnownTypes ()
 
 isKnownType ($type)
 
 getFullyQualifiedType ($type)
 
 getSimpleType ($type)
 
 load (ObjectId $oid, $buildDepth=BuildDepth::SINGLE)
 
 create ($type, $buildDepth=BuildDepth::SINGLE)
 
 getLastCreatedOID ($type)
 
 getOIDs ($type, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 getFirstOID ($type, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 loadObjects ($typeOrTypes, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 loadFirstObject ($typeOrTypes, $buildDepth=BuildDepth::SINGLE, $criteria=null, $orderby=null, PagingInfo $pagingInfo=null)
 
 getTransaction ()
 
 getMapper ($type)
 
 setMapper ($type, PersistenceMapper $mapper)
 

Member Function Documentation

◆ getKnownTypes()

getKnownTypes ( )

Get a list of types defined in the application.

Returns
The list of fully qualified type names

Implemented in DefaultPersistenceFacade.

◆ isKnownType()

isKnownType (   $type)

Check if a type is defined in the application.

Parameters
$typeThe type to check (either fully qualified or simple, if not ambiguous)
Returns
Boolean whether the type is defined or not

Implemented in DefaultPersistenceFacade.

◆ getFullyQualifiedType()

getFullyQualifiedType (   $type)

Get the fully qualified type name for a given simple type name.

Parameters
$typeType name without namespace
Returns
Fully qualified type name (with namespace)

Implemented in DefaultPersistenceFacade.

◆ getSimpleType()

getSimpleType (   $type)

Get the simple type name for a given fully qualified type name.

Parameters
$typeType name with namespace
Returns
Simple type name (without namespace)

Implemented in DefaultPersistenceFacade.

◆ load()

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

Load an object from the storage.

The object will be attached to the transaction, if the transaction is active.

Note
The parameter buildDepth is used to improve fetching from the storage, but objects returned by this method are not guaranteed to only contain the parameter values. This is especially true, if the same object was loaded before with a wider fetch definition (e.g. greater buildDeph value)
Parameters
$oidThe object id of the object to construct
$buildDepthOne of the BUILDDEPTH constants or a number describing the number of generations to build (except BuildDepth::REQUIRED, BuildDepth::PROXIES_ONLY) (default: BuildDepth::SINGLE)
Returns
PersistentObject, null if oid does not exist or a given condition prevents loading.

Implemented in DefaultPersistenceFacade, and RemoteCapablePersistenceFacade.

◆ create()

create (   $type,
  $buildDepth = BuildDepth::SINGLE 
)

Construct the template of an object of a given type.

The object will be attached to the transaction, if the transaction is active.

Note
If an object required to be transient, the IPersistentMapper::create() method or the class constructor must be used.
Parameters
$typeThe type of object to build (either fully qualified or simple, if not ambiguous)
$buildDepthOne of the BUILDDEPTH constants or a number describing the number of generations to build (except BuildDepth::INFINITE, BuildDepth::PROXIES_ONLY) (default: BuildDepth::SINGLE)
Returns
PersistentObject

Implemented in DefaultPersistenceFacade, and RemoteCapablePersistenceFacade.

◆ getLastCreatedOID()

getLastCreatedOID (   $type)

Get the object id of the last created object of a given type.

Parameters
$typeThe type of the object (either fully qualified or simple, if not ambiguous)
Returns
ObjectId or null

Implemented in DefaultPersistenceFacade.

◆ getOIDs()

getOIDs (   $type,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)

Get the object ids of objects matching a given criteria.

If a PagingInfo instance is passed it will be used and updated.

Parameters
$typeThe type of the object (either fully qualified or simple, if not ambiguous)
$criteriaAn array of Criteria instances that define conditions on the type's attributes (optional, default: null)
$orderbyAn array holding names of attributes to order by, maybe appended with 'ASC', 'DESC' (optional, default: null)
$pagingInfoA reference PagingInfo instance. (default: null)
Returns
Array containing the ObjectId instances

Implemented in DefaultPersistenceFacade, and RemoteCapablePersistenceFacade.

◆ getFirstOID()

getFirstOID (   $type,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)

Get the first object id of objects matching a given condition.

If a PagingInfo instance is passed it will be used and updated.

Parameters
$typeThe type of the object (either fully qualified or simple, if not ambiguous)
$criteriaAn array of Criteria instances that define conditions on the type's attributes (optional, default: null)
$orderbyAn array holding names of attributes to order by, maybe appended with 'ASC', 'DESC' (optional, default: null)
$pagingInfoA reference PagingInfo instance. (default: null)
Returns
ObjectId or null

Implemented in DefaultPersistenceFacade.

◆ loadObjects()

loadObjects (   $typeOrTypes,
  $buildDepth = BuildDepth::SINGLE,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)

Load the objects matching a given condition.

If a PagingInfo instance is passed it will be used and updated.

Parameters
$typeOrTypesThe type or types array of objects (either fully qualified or simple, if not ambiguous)
$buildDepthOne of the BUILDDEPTH constants or a number describing the number of generations to build (except BuildDepth::REQUIRED, BuildDepth::PROXIES_ONLY) (default: BuildDepth::SINGLE)
$criteriaAn array of Criteria instances that define conditions on the object's attributes (optional, default: null)
$orderbyAn array holding names of attributes to order by, maybe appended with 'ASC', 'DESC' (optional, default: null)
$pagingInfoA reference PagingInfo instance (optional, default: null)
Returns
Array containing the PersistentObject instances

Implemented in DefaultPersistenceFacade, and RemoteCapablePersistenceFacade.

◆ loadFirstObject()

loadFirstObject (   $typeOrTypes,
  $buildDepth = BuildDepth::SINGLE,
  $criteria = null,
  $orderby = null,
PagingInfo  $pagingInfo = null 
)

Load the first object matching a given condition.

If a PagingInfo instance is passed it will be used and updated.

Parameters
$typeOrTypesThe type or types array of objects (either fully qualified or simple, if not ambiguous)
$buildDepthOne of the BUILDDEPTH constants or a number describing the number of generations to build (except BuildDepth::REQUIRED, BuildDepth::PROXIES_ONLY) (default: BuildDepth::SINGLE)
$criteriaAn array of Criteria instances that define conditions on the type's attributes (optional, default: null)
$orderbyAn array holding names of attributes to order by, maybe appended with 'ASC', 'DESC' (optional, default: null)
$pagingInfoA reference PagingInfo instance (default: null)
Returns
PersistentObject or null

Implemented in DefaultPersistenceFacade.

◆ getTransaction()

getTransaction ( )

Get the current business transaction.

Note
There is only one transaction instance at the same time.
Returns
Transaction

Implemented in DefaultPersistenceFacade.

◆ getMapper()

getMapper (   $type)

Get the PersistenceMapper for a given type.

If no mapper for this type is defined the mapper for type '*' will be returned

Parameters
$typeThe type of the object to get the PersistenceMapper for (either fully qualified or simple, if not ambiguous)
Returns
PersistenceMapper or null on error

Implemented in DefaultPersistenceFacade.

◆ setMapper()

setMapper (   $type,
PersistenceMapper  $mapper 
)

Explicitly set a PersistentMapper for a type.

Parameters
$typeThe type to set the mapper for (fully qualified)
$mapperPersistenceMapper instance

Implemented in DefaultPersistenceFacade.