/** * @param DB $db RDBMS to use * @param IQueryable $entity ORM-related entity representation */ function __construct(DB $db, IQueryable $entity) { $this->db = $db; $this->entity = $entity; $this->map = $entity->getMap(); $this->logicalSchema = $entity->getLogicalSchema(); $this->physicalSchema = $entity->getPhysicalSchema(); $this->identifier = $this->logicalSchema->getIdentifier(); if ($this->identifier) { $this->identityMap = new OrmIdentityMap($this->logicalSchema); } }
function getBatchMapper() { if (!$this->logicalSchema->getIdentifier()) { return $this; } return new BatchOrmMap($this->logicalSchema, $this); }
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; }