/** * @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); } }
/** * @return EntityQueryBuilder */ function joinEncapsulant($encapsulant) { Assert::isScalar($encapsulant); if (!isset($this->joined[$encapsulant])) { $property = $this->entity->getLogicalSchema()->getProperty($encapsulant); $type = $property->getType(); Assert::isTrue($type instanceof AssociationPropertyType); $builder = $this->joined[$encapsulant] = new self($type->getContainer(), $this->alias . '_' . $encapsulant); $builder->joins = array(); $this->join($property, $type, $builder, end($this->joins)); } return $this->joined[$encapsulant]; }
function getContainerClassName(OrmProperty $property) { return $this->container->getLogicalSchema()->getEntityName() . ucfirst($property->getName()) . 'Container'; }
/** * Gets the value of the entity's property. The value is obtained according to the current * setting of EntityQuery and the FetchStrategy set inside DAO of the entity * @param string name of the property * @return scalar */ function getProperty($property) { return $this->entity->getDao()->getProperty($this->makeSelect(Projection::property($property))); }
protected function getCtorArgumentsPhpCode() { return array($this->container->getLogicalSchema()->getEntityName() . '::orm()', 'new AssociationMultiplicity(AssociationMultiplicity::' . $this->multiplicity->getId() . ')', 'new AssociationBreakAction(AssociationBreakAction::' . $this->action->getId() . ')'); }
protected function getCtorArgumentsPhpCode() { $proxyName = $this->proxy->getLogicalSchema()->getEntityName(); return array($proxyName . '::orm()', $this->container->toPhpCall(), $this->encapsulant->toPhpCall()); }
function fill(SelectQuery $selectQuery, EntityQueryBuilder $entityQueryBuilder) { foreach ($this->entity->getPhysicalSchema()->getFields() as $field) { $this->fillField($field, $selectQuery, $entityQueryBuilder); } }
/** * @aux * @return EntityProperty */ private function guessEntityProperty($path) { $chunks = explode('.', $path); $name = reset($chunks); return $this->processProperty(join('.', array_slice($chunks, 1)), $this->entity->getLogicalSchema()->getProperty($name)); }