Пример #1
0
 function __construct(ILogicallySchematic $logicalSchema)
 {
     $identifier = $logicalSchema->getIdentifier();
     if (!$identifier) {
         throw new OrmModelIntegrityException('IdentityMapOrmDao is for identifierable entities only');
     }
     if ($identifier->getVisibility()->isNot(OrmPropertyVisibility::FULL)) {
         throw new OrmModelIntegrityException('identifier property should have FULL access level');
     }
     $this->stubObject = $logicalSchema->getNewEntity();
     Assert::isTrue($this->stubObject instanceof IdentifiableOrmEntity, '%s should implement IdentifiableOrmEntity', $logicalSchema->getEntityName());
     $this->identifier = $identifier;
 }
Пример #2
0
 private function touchEntity(array $tuple)
 {
     if (!$this->identifier) {
         return $this->logicalSchema->getNewEntity();
     }
     $idTuple = array();
     foreach ($this->identifier->getFields() as $field) {
         $idTuple[] = $tuple[$field];
     }
     $idTuple = array_combine(array_keys($this->identifier->getType()->getSqlTypes()), array_values($idTuple));
     $id = $this->identifier->getType()->assemble($idTuple, FetchStrategy::lazy());
     return $this->getLazyEntityById($id);
 }