示例#1
0
 /**
  * @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);
     }
 }
示例#2
0
 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;
 }