PHP Class Storm\Core\Object\Domain

The domain represents a group of entities, their properties and relationships. A single entity is represented through an entity map.
Author: Elliot Levin ([email protected])
Inheritance: use trait Storm\Core\Helpers\Type
Mostrar archivo Open project: timetoogo/penumbra Class Usage Examples

Public Methods

Method Description
Apply ( object $Entity, PropertyData $PropertyData ) : void Applies the supplied property data to the supplied entity instance.
BuildUnitOfWork ( array $EntitiesToPersist = [], array $ProceduresToExecute = [], array $EntitiesToDiscard = [], array $CriterionToDiscard = [] ) : UnitOfWork Constructs a unit of work instance containing the supplied operations to commit.
Discard ( UnitOfWork $UnitOfWork, object $Entity ) : DiscardenceData Discard an entity relationships to the supplied unit of work and returns the entity's discardence data.
DiscardedIdentifyingRelationship ( $ParentEntity, object $ChildEntity, UnitOfWork $UnitOfWork ) : DiscardedRelationship Constructs a discarded identifying relationship between the parent and child entity.
DiscardedRelationship ( object $Entity, object $RelatedEntity ) : DiscardedRelationship Constructs a discarded non-identifying relationship between the two supplied entities.
DoShareIdentity ( object $Entity, object $OtherEntity ) : boolean Determines is two entities share the same identity.
GetEntityMap ( string $EntityType ) : Storm\Core\Object\IEntityMap | null
GetEntityMaps ( ) : Storm\Core\Object\IEntityMap[]
HasEntityMap ( string $EntityType ) : boolean
HasIdentity ( object $Entity ) : boolean
Identity ( object $Entity ) : Identity Gets the identity from the supplied entity.
LoadEntities ( RevivalData $RevivalData, array $Entities ) : void Loads an array of entities with the supplied revival data.
LoadEntity ( RevivalData $RevivalData, object $Entity ) : void Loads an entity instance with the supplied revival data.
Persist ( UnitOfWork $UnitOfWork, object $Entity ) : PersistenceData Persists an entity relationships to the supplied unit of work and returns the entity's persistence data.
PersistRelationships ( UnitOfWork $UnitOfWork, object $Entity ) : void Persists an entity relationships to the supplied unit of work.
PersistedIdentifyingRelationship ( $ParentEntity, object $ChildEntity, UnitOfWork $UnitOfWork ) : PersistedRelationship Constructs a persisted identifying relationship between the parent and child entity.
PersistedRelationship ( $ParentEntity, object $RelatedEntity ) : PersistedRelationship Constructs a discarded non-identifying relationship between the two supplied entities.
ReviveEntities ( string $EntityType, array $RevivalData ) : object[] Revives an array of entities from the supplied array of revival data.
__construct ( )

Protected Methods

Method Description
AddEntityMap ( Storm\Core\Object\IEntityMap $EntityMap ) : void Adds an entity map to the domain.
RegisterEntityMaps ( Registrar $Registrar ) : void The method to register the entity maps within this domain.

Private Methods

Method Description
VerifyEntity ( string $Method, object $Entity ) : Storm\Core\Object\IEntityMap Verifies that an entity is valid in this domain.

Method Details

AddEntityMap() final protected method

Adds an entity map to the domain.
final protected AddEntityMap ( Storm\Core\Object\IEntityMap $EntityMap ) : void
$EntityMap Storm\Core\Object\IEntityMap The entity map to add.
return void

Apply() final public method

Applies the supplied property data to the supplied entity instance.
final public Apply ( object $Entity, PropertyData $PropertyData ) : void
$Entity object The entity to apply the property data
$PropertyData PropertyData The property data apply
return void

BuildUnitOfWork() final public method

Constructs a unit of work instance containing the supplied operations to commit.
final public BuildUnitOfWork ( array $EntitiesToPersist = [], array $ProceduresToExecute = [], array $EntitiesToDiscard = [], array $CriterionToDiscard = [] ) : UnitOfWork
$EntitiesToPersist array
$ProceduresToExecute array
$EntitiesToDiscard array
$CriterionToDiscard array
return UnitOfWork The constructed unit of work

Discard() final public method

Discard an entity relationships to the supplied unit of work and returns the entity's discardence data.
final public Discard ( UnitOfWork $UnitOfWork, object $Entity ) : DiscardenceData
$UnitOfWork UnitOfWork The unit of work to discard to
$Entity object The entity to discard
return DiscardenceData The discardence data of the entity

DiscardedIdentifyingRelationship() final public method

NOTE: The child entity relationships will be discarded in the supplied unit of work.
final public DiscardedIdentifyingRelationship ( $ParentEntity, object $ChildEntity, UnitOfWork $UnitOfWork ) : DiscardedRelationship
$ChildEntity object
$UnitOfWork UnitOfWork
return DiscardedRelationship The discarded relationship

DiscardedRelationship() final public method

Constructs a discarded non-identifying relationship between the two supplied entities.
final public DiscardedRelationship ( object $Entity, object $RelatedEntity ) : DiscardedRelationship
$Entity object
$RelatedEntity object
return DiscardedRelationship The discarded relationship

DoShareIdentity() final public method

Determines is two entities share the same identity.
final public DoShareIdentity ( object $Entity, object $OtherEntity ) : boolean
$Entity object
$OtherEntity object
return boolean Whether or not that the entities have the same identity

GetEntityMap() final public method

final public GetEntityMap ( string $EntityType ) : Storm\Core\Object\IEntityMap | null
$EntityType string The type of entity that the entity map represents
return Storm\Core\Object\IEntityMap | null The entity map or null if it is not registered

GetEntityMaps() final public method

final public GetEntityMaps ( ) : Storm\Core\Object\IEntityMap[]
return Storm\Core\Object\IEntityMap[] The registered entity maps

HasEntityMap() final public method

final public HasEntityMap ( string $EntityType ) : boolean
$EntityType string The type of entity
return boolean

HasIdentity() final public method

final public HasIdentity ( object $Entity ) : boolean
$Entity object The entity to check
return boolean Whether or not the entity has an identity

Identity() final public method

Gets the identity from the supplied entity.
final public Identity ( object $Entity ) : Identity
$Entity object
return Identity

LoadEntities() final public method

Loads an array of entities with the supplied revival data.
final public LoadEntities ( RevivalData $RevivalData, array $Entities ) : void
$RevivalData RevivalData The revival data to load the entity with
$Entities array The entities to load
return void

LoadEntity() final public method

Loads an entity instance with the supplied revival data.
final public LoadEntity ( RevivalData $RevivalData, object $Entity ) : void
$RevivalData RevivalData The revival data to load the entity with
$Entity object The entity to load
return void

Persist() final public method

Persists an entity relationships to the supplied unit of work and returns the entity's persistence data.
final public Persist ( UnitOfWork $UnitOfWork, object $Entity ) : PersistenceData
$UnitOfWork UnitOfWork The unit of work to persist to
$Entity object The entity to persist
return PersistenceData The persistence data of the entity

PersistRelationships() final public method

Persists an entity relationships to the supplied unit of work.
final public PersistRelationships ( UnitOfWork $UnitOfWork, object $Entity ) : void
$UnitOfWork UnitOfWork The unit of work to persist to
$Entity object The entity to persist
return void The persistence data of the entity

PersistedIdentifyingRelationship() final public method

NOTE: The child entity relationships will be persisted in the supplied unit of work.
final public PersistedIdentifyingRelationship ( $ParentEntity, object $ChildEntity, UnitOfWork $UnitOfWork ) : PersistedRelationship
$ChildEntity object
$UnitOfWork UnitOfWork
return PersistedRelationship The persisted relationship

PersistedRelationship() final public method

Constructs a discarded non-identifying relationship between the two supplied entities.
final public PersistedRelationship ( $ParentEntity, object $RelatedEntity ) : PersistedRelationship
$RelatedEntity object
return PersistedRelationship The persisted relationship

RegisterEntityMaps() abstract protected method

The method to register the entity maps within this domain.
abstract protected RegisterEntityMaps ( Registrar $Registrar ) : void
$Registrar Storm\Core\Containers\Registrar
return void

ReviveEntities() final public method

Revives an array of entities from the supplied array of revival data.
final public ReviveEntities ( string $EntityType, array $RevivalData ) : object[]
$EntityType string The type of entities to revive
$RevivalData array The array of revival data
return object[] The revived entities

__construct() public method

public __construct ( )