/** * {@inheritDoc} */ public final function Initialize(DomainDatabaseMap $DomainDatabaseMap) { $this->OnInitialize($DomainDatabaseMap); $this->EntityMap = $this->EntityMap($DomainDatabaseMap->GetDomain()); $this->EntityType = $this->EntityMap->GetEntityType(); if (!$this->EntityMap instanceof Object\IEntityMap) { throw new \Storm\Core\UnexpectedValueException('Return value from %s->EntityMap() must be an instance of %s, %s given', get_class($this), Object\IEntityMap::IEntityMapType, \Storm\Core\Utilities::GetTypeOrClass($this->EntityMap)); } $Database = $DomainDatabaseMap->GetDatabase(); $Registrar = new Registrar(IPropertyMapping::IPropertyMappingType); $this->RegisterPropertyMappings($Registrar, $this->EntityMap, $Database); foreach ($Registrar->GetRegistered() as $PropertyMapping) { $this->AddPropertyMapping($PropertyMapping); } foreach ($this->MappedReviveColumns as $MappedReviveColumn) { $Table = $MappedReviveColumn->GetTable(); $this->ReviveTables[$Table->GetName()] = $Table; } foreach ($this->MappedPersistColumns as $MappedPersistColumn) { $Table = $MappedPersistColumn->GetTable(); $this->PersistTables[$Table->GetName()] = $Table; } if ($this->PrimaryKeyTable === null) { throw new MappingException('The property mappings of %s must contain atleast 1 identity primary key mapping', get_class($this)); } $this->OnInitialized($DomainDatabaseMap); }
public function __construct(Object\IEntityMap $EntityMap, FunctionToASTConverter $FunctionToASTConverter) { $this->EntityMap = $EntityMap; $this->EntityType = $EntityMap->GetEntityType(); $this->FunctionToASTConverter = $FunctionToASTConverter; $this->Criterion = new Criterion($EntityMap->GetEntityType()); }
public final function SetEntityMap(IEntityMap $EntityMap = null) { $this->EntityMap = $EntityMap; if ($EntityMap !== null) { $this->Accessor->SetEntityType($EntityMap->GetEntityType()); $this->Identifier = $this->Accessor->GetIdentifier(); } }
/** * Adds an entity map to the domain. * * @param EntityMap $EntityMap The entity map to add. * @return void */ protected final function AddEntityMap(IEntityMap $EntityMap) { $EntityMap->InititalizeProperties($this); $this->EntityMaps[$EntityMap->GetEntityType()] = $EntityMap; }