PHP Class Storm\Core\Mapping\DomainDatabaseMap

Author: Elliot Levin ([email protected])
显示文件 Open project: timetoogo/penumbra Class Usage Examples

Public Methods

Method Description
Commit ( array $EntitiesToPersist, array $ProceduresToExecute, array $EntitiesToDiscard, array $CriteriaToDiscard ) : void Commits the supplied operations to the underlying database within a transactional scope.
Factory ( ) This class can be very expensive to instantiate, so this provides a factory closure if required.
GetDatabase ( ) : Database
GetDomain ( ) : Domain
GetEntityRelationalMap ( string $EntityType ) : Storm\Core\Mapping\IEntityRelationalMap | null Gets the registered relational map for the given entity type.
GetEntityRelationalMapByPrimaryKeyTable ( string $TableName ) : IEntityRelationalMap:null Gets the registered relational map for the given primary key table name.
HasEntityRelationalMap ( string $EntityType ) : boolean Returns if this contains an relational map for the given type of entity.
Load ( Storm\Core\Object\IRequest $ObjectRequest ) : array | object | null Loads all entities that are specified from the given request instance.
MapDiscardedRelationships ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $ObjectDiscardedRelationships ) : DiscardedRelationship[]
MapEntityToRelationalRequest ( string $EntityType, Request $RelationalRequest, array $AlreadyKnownProperties = [] ) : void
MapPersistedRelationships ( UnitOfWork $UnitOfWork, Transaction $Transaction, Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $ObjectPersistedRelationships ) : PersistedRelationship[]
MapProcedure ( Storm\Core\Object\IProcedure $ObjectProcedure ) : Procedure
MapRelationshipChanges ( UnitOfWork $UnitOfWork, Transaction $Transaction, Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $ObjectRelationshipChanges ) : RelationshipChange
MapRequest ( Storm\Core\Object\IRequest $ObjectRequest ) : Request
MapResultRowDataToRevivalData ( $EntityType, ResultRow $ResultRow )
MapResultRowsToRevivalData ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $ResultRowArray, array $RevivalDataArray )
MapRowsToRevivalData ( string $EntityType, array $ResultRows ) : RevivalData[]
__construct ( )

Protected Methods

Method Description
Database ( ) : Database The method to specify the database instance.
Domain ( ) : Domain The method to specify the domain instance.
MapExpression ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, Expression $Expression ) : Expression[]
RegisterEntityRelationalMaps ( Registrar $Registrar ) This is where you register your EntityRelationalMap classes.
VerifyEntityTypeIsMapped ( string $EntityType ) : Storm\Core\Mapping\IEntityRelationalMap Verifies that an entity type is mapped and returns the relational map if is found.

Private Methods

Method Description
AddEntityRelationMap ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap ) Adds an entity relational map instance to this domain database map.
MapCriterion ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, Storm\Core\Object\ICriterion $ObjectCriterion, Criterion $RelationalCriterion ) : void
MapEntityDataToTransaction ( UnitOfWork $UnitOfWork, Transaction $Transaction, Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $EntityDataArray ) : Storm\Core\Relational\ResultRows[]
MapExpressions ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $Expressions ) : Expression[]
MapObjectCriterion ( Storm\Core\Object\ICriterion $ObjectCriterion ) : Criterion
MapPersistenceDataToTransaction ( UnitOfWork $UnitOfWork, Transaction $Transaction, array $PersistenceDataArray ) : Storm\Core\Relational\ResultRows[]
MapPropetiesToRelationalRequest ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, Request $RelationalRequest, array $Properties = null ) : void
MapUnitOfWorkToTransaction ( UnitOfWork $UnitOfWork, Transaction $Transaction ) : void

Method Details

Commit() final public method

Commits the supplied operations to the underlying database within a transactional scope.
final public Commit ( array $EntitiesToPersist, array $ProceduresToExecute, array $EntitiesToDiscard, array $CriteriaToDiscard ) : void
$EntitiesToPersist array The entities to persist
$ProceduresToExecute array The procedures to execute
$EntitiesToDiscard array The entities to discard
$CriteriaToDiscard array The criteria of entities to discard
return void

Database() abstract protected method

The method to specify the database instance.
abstract protected Database ( ) : Database
return Storm\Core\Relational\Database

Domain() abstract protected method

The method to specify the domain instance.
abstract protected Domain ( ) : Domain
return Storm\Core\Object\Domain

Factory() final public static method

This class can be very expensive to instantiate, so this provides a factory closure if required.
final public static Factory ( )

GetDatabase() final public method

final public GetDatabase ( ) : Database
return Storm\Core\Relational\Database The Database instance

GetDomain() final public method

final public GetDomain ( ) : Domain
return Storm\Core\Object\Domain The Domain instance

GetEntityRelationalMap() final public method

Gets the registered relational map for the given entity type.
final public GetEntityRelationalMap ( string $EntityType ) : Storm\Core\Mapping\IEntityRelationalMap | null
$EntityType string The type of the entity (sub classes will resolve)
return Storm\Core\Mapping\IEntityRelationalMap | null The relational map or null if not found

GetEntityRelationalMapByPrimaryKeyTable() final public method

Gets the registered relational map for the given primary key table name.
final public GetEntityRelationalMapByPrimaryKeyTable ( string $TableName ) : IEntityRelationalMap:null
$TableName string The name of primary key table.
return IEntityRelationalMap:null

HasEntityRelationalMap() final public method

Returns if this contains an relational map for the given type of entity.
final public HasEntityRelationalMap ( string $EntityType ) : boolean
$EntityType string The type of the entity
return boolean

Load() final public method

Loads all entities that are specified from the given request instance.
final public Load ( Storm\Core\Object\IRequest $ObjectRequest ) : array | object | null
$ObjectRequest Storm\Core\Object\IRequest The request to load
return array | object | null Depending on the supplied request, either all the entities are returned as an array or the first is returned or null if none are found.

MapDiscardedRelationships() final public method

final public MapDiscardedRelationships ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $ObjectDiscardedRelationships ) : DiscardedRelationship[]
$EntityRelationalMap Storm\Core\Mapping\IEntityRelationalMap
$ObjectDiscardedRelationships array
return Storm\Core\Relational\DiscardedRelationship[]

MapEntityToRelationalRequest() final public method

final public MapEntityToRelationalRequest ( string $EntityType, Request $RelationalRequest, array $AlreadyKnownProperties = [] ) : void
$EntityType string The type of entity
$RelationalRequest Storm\Core\Relational\Request The request to add to
$AlreadyKnownProperties array
return void

MapExpression() abstract protected method

abstract protected MapExpression ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, Expression $Expression ) : Expression[]
$EntityRelationalMap Storm\Core\Mapping\IEntityRelationalMap
$Expression Storm\Core\Object\Expressions\Expression
return Storm\Core\Relational\Expressions\Expression[] The equivalent expressions

MapPersistedRelationships() final public method

final public MapPersistedRelationships ( UnitOfWork $UnitOfWork, Transaction $Transaction, Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $ObjectPersistedRelationships ) : PersistedRelationship[]
$UnitOfWork Storm\Core\Object\UnitOfWork
$Transaction Storm\Core\Relational\Transaction
$EntityRelationalMap Storm\Core\Mapping\IEntityRelationalMap
$ObjectPersistedRelationships array
return Storm\Core\Relational\PersistedRelationship[]

MapProcedure() final public method

final public MapProcedure ( Storm\Core\Object\IProcedure $ObjectProcedure ) : Procedure
$ObjectProcedure Storm\Core\Object\IProcedure The object procedure
return Storm\Core\Relational\Procedure The equivalent relational procedure

MapRelationshipChanges() final public method

final public MapRelationshipChanges ( UnitOfWork $UnitOfWork, Transaction $Transaction, Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $ObjectRelationshipChanges ) : RelationshipChange
$UnitOfWork Storm\Core\Object\UnitOfWork
$Transaction Storm\Core\Relational\Transaction
$EntityRelationalMap Storm\Core\Mapping\IEntityRelationalMap
$ObjectRelationshipChanges array
return Storm\Core\Relational\RelationshipChange

MapRequest() final public method

final public MapRequest ( Storm\Core\Object\IRequest $ObjectRequest ) : Request
$ObjectRequest Storm\Core\Object\IRequest The object request
return Storm\Core\Relational\Request The equivalent relational request

MapResultRowDataToRevivalData() final public method

final public MapResultRowDataToRevivalData ( $EntityType, ResultRow $ResultRow )
$ResultRow Storm\Core\Relational\ResultRow

MapResultRowsToRevivalData() final public method

final public MapResultRowsToRevivalData ( Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap, array $ResultRowArray, array $RevivalDataArray )
$EntityRelationalMap Storm\Core\Mapping\IEntityRelationalMap The entity relational map
$ResultRowArray array
$RevivalDataArray array

MapRowsToRevivalData() final public method

final public MapRowsToRevivalData ( string $EntityType, array $ResultRows ) : RevivalData[]
$EntityType string The type of entity to revive as
$ResultRows array The result row to ma
return Storm\Core\Object\RevivalData[] The mapped revival data

RegisterEntityRelationalMaps() abstract protected method

This is where you register your EntityRelationalMap classes.
abstract protected RegisterEntityRelationalMaps ( Registrar $Registrar )
$Registrar Storm\Core\Containers\Registrar

VerifyEntityTypeIsMapped() final protected method

Verifies that an entity type is mapped and returns the relational map if is found.
final protected VerifyEntityTypeIsMapped ( string $EntityType ) : Storm\Core\Mapping\IEntityRelationalMap
$EntityType string The entity type
return Storm\Core\Mapping\IEntityRelationalMap The registered entity relational map

__construct() public method

public __construct ( )