コード例 #1
0
ファイル: UnionQuery.php プロジェクト: Warsaalk/Plinth
 /** 
  * (non-PHPdoc)
  * @see IQuery::get()
  */
 public function get($end = true)
 {
     $return = "(" . $this->firstQuery->get(false) . ")" . self::UNION . "(" . $this->secondQuery->get(false) . ")";
     if ($this->hasOrderBy()) {
         $return .= $this->getOrderBy();
     }
     return $return . $this->getEnd($end);
 }
コード例 #2
0
ファイル: JoinQuery.php プロジェクト: Warsaalk/Plinth
 /**
  * @return string
  */
 private function getToJoin()
 {
     if ($this->tojoin instanceof SelectQuery || $this->tojoin instanceof UnionQuery) {
         return " (" . $this->tojoin->get(false) . ")";
     } else {
         return " " . $this->tojoin;
     }
 }
コード例 #3
0
 /**
  * Adds the table field to the SELECT list
  *
  * @param string $field
  * @param SelectQuery $selectQuery
  * @param EntityQueryBuilder $entityQueryBuilder
  */
 protected function fillPropertyField($field, SelectQuery $selectQuery, EntityQueryBuilder $entityQueryBuilder)
 {
     $entityQueryBuilder->registerIdentifier($field);
     $selectQuery->get(new SqlColumn($field, $entityQueryBuilder->getAlias()));
 }
コード例 #4
0
 function fill(SelectQuery $selectQuery, EntityQueryBuilder $entityQueryBuilder)
 {
     $selectQuery->get($this->getSqlFunction($entityQueryBuilder));
 }
コード例 #5
0
 private function joinProperties(SelectQuery $query, ProtoDAO $parentDao, $parentTable, $parentRequired, $prefix = null)
 {
     $proto = call_user_func(array($parentDao->getObjectName(), 'proto'));
     foreach ($proto->getPropertyList() as $property) {
         if ($property instanceof LightMetaProperty && $property->getRelationId() == MetaRelation::ONE_TO_ONE && !$property->isGenericType() && (!$property->getFetchStrategyId() && $this->getFetchStrategy()->getId() == FetchStrategy::JOIN || $property->getFetchStrategyId() == FetchStrategy::JOIN)) {
             if (is_subclass_of($property->getClassName(), 'Enumeration')) {
                 // field already added by makeSelectHead
                 continue;
             } elseif ($property->isInner()) {
                 $proto = call_user_func(array($property->getClassName(), 'proto'));
                 foreach ($proto->getPropertyList() as $innerProperty) {
                     $query->get(new DBField($innerProperty->getColumnName(), $parentTable));
                 }
                 continue;
             }
             $propertyDao = call_user_func(array($property->getClassName(), 'dao'));
             // add's custom dao's injection possibility
             if (!$propertyDao instanceof ProtoDAO) {
                 continue;
             }
             $tableAlias = $propertyDao->getJoinName($property->getColumnName(), $prefix);
             $fields = $propertyDao->getFields();
             if (!$query->hasJoinedTable($tableAlias)) {
                 $logic = Expression::eq(DBField::create($property->getColumnName(), $parentTable), DBField::create($propertyDao->getIdName(), $tableAlias));
                 if ($property->isRequired() && $parentRequired) {
                     $query->join($propertyDao->getTable(), $logic, $tableAlias);
                 } else {
                     $query->leftJoin($propertyDao->getTable(), $logic, $tableAlias);
                 }
             }
             foreach ($fields as $field) {
                 $query->get(new DBField($field, $tableAlias), $propertyDao->getJoinPrefix($property->getColumnName(), $prefix) . $field);
             }
             $this->joinProperties($query, $propertyDao, $tableAlias, $property->isRequired() && $parentRequired, $propertyDao->getJoinPrefix($property->getColumnName(), $prefix));
         }
     }
 }
コード例 #6
0
 function fill(SelectQuery $selectQuery, EntityQueryBuilder $entityQueryBuilder)
 {
     $selectQuery->get($this->getValueExpression($entityQueryBuilder));
 }