Author: Elliot Levin (elliotlevin@hotmail.com)
Inheritance: extends Segment
 public function visitOrderBy(Segments\OrderBy $segment)
 {
     foreach ($segment->getOrderings() as $ordering) {
         $this->parameters->addId($ordering->getIsAscendingId(), ParameterHasher::valueType());
     }
     return parent::visitOrderBy($segment);
 }
 public function visitOrderBy(Segments\OrderBy $segment)
 {
     $staticOrderings = [];
     foreach ($segment->getOrderings() as $key => $ordering) {
         $staticOrderings[$key] = new StaticOrdering($ordering->getProjectionFunction(), $this->parameters->getResolvedParameters()[$ordering->getIsAscendingId()]);
     }
     return parent::visitOrderBy($segment->update($staticOrderings));
 }
示例#3
0
 public function visitOrderBy(Segments\OrderBy $segment)
 {
     $orderings = [];
     foreach ($segment->getOrderings() as $key => $ordering) {
         $orderings[$key] = $ordering->update($this->expressionProcessor->processFunction($ordering->getProjectionFunction()));
     }
     return parent::visitOrderBy($segment->update($orderings));
 }
示例#4
0
 public function visitOrderBy(Segments\OrderBy $query)
 {
     $first = true;
     foreach ($query->getOrderings() as $orderFunction) {
         $direction = $this->resolvedParameters[$orderFunction->getIsAscendingId()] ? Direction::ASCENDING : Direction::DESCENDING;
         if ($first) {
             $this->traversable = $this->traversable->orderBy($this->resolvedParameters[$orderFunction->getProjectionFunction()->getCallableId()], $direction);
             $first = false;
         } else {
             $this->traversable = $this->traversable->thenBy($this->resolvedParameters[$orderFunction->getProjectionFunction()->getCallableId()], $direction);
         }
     }
 }
示例#5
0
 public function visitOrderBy(Segments\OrderBy $query)
 {
     $this->compilation->append('Order according to: ');
     $first = true;
     foreach ($query->getOrderings() as $ordering) {
         if ($first === true) {
             $first = false;
         } else {
             $this->compilation->append(', ');
         }
         $this->compilation->appendFunction($ordering->getProjectionFunction());
         $this->compilation->append(' asc or desc');
     }
     $this->compilation->appendLine();
 }
示例#6
0
 public function visitOrderBy(Segments\OrderBy $query)
 {
     $orderings = [];
     foreach ($query->getOrderings() as $ordering) {
         if (!$ordering instanceof StaticOrdering) {
             throw new PinqDemoSqlException('Ordering must be a static ordering class');
         }
         $orderings[] = $this->compileReturn($ordering->getProjectionFunction()) . ' ' . ($ordering->isAscending() ? 'ASC' : 'DESC');
     }
     $this->deriveSelect();
     $this->compilation->sql .= ' ORDER BY ' . implode(', ', $orderings);
 }