Author: Elliot Levin (elliotlevin@hotmail.com)
Exemplo n.º 1
0
 public function interpretSource(O\Expression $expression)
 {
     $isQueryScope = false;
     $queryableQueryResolver = new O\DynamicExpressionWalker([O\TraversalExpression::getType() => function (O\TraversalExpression $expression, O\ExpressionWalker $self) use(&$isQueryScope) {
         $expression = $expression->updateValue($self->walk($expression->getValue()));
         if ($isQueryScope) {
             return $expression;
         } else {
             return $self->walk(O\Expression::value($expression->evaluate($this->evaluationContext)));
         }
     }, O\ValueExpression::getType() => function (O\ValueExpression $expression) use(&$isQueryScope) {
         if ($expression->getValue() instanceof IQueryable) {
             $isQueryScope = true;
         }
         return $expression;
     }]);
     $expression = $queryableQueryResolver->walk($expression);
     if ($isQueryScope) {
         $this->scopeInterpreter->interpretScope($expression);
         $this->interpretation->interpretQueryScope($this->getId('source-scope'), $this->scopeInterpreter->getInterpretation());
     } else {
         $this->interpretation->interpretArrayOrIterator($this->getId('source-iterator'), $expression->evaluate($this->evaluationContext));
     }
 }
Exemplo n.º 2
0
 public function interpretOperation($segmentId, $operationType, ISourceInterpretation $sourceInterpretation)
 {
     /* @var $sourceInterpretation ISourceParser */
     $this->segments[] = new Segments\Operation($operationType, $sourceInterpretation->getSource());
 }
Exemplo n.º 3
0
 public function interpretRemoveRange($operationId, ISourceInterpretation $sourceInterpretation)
 {
     /** @var $sourceInterpretation ISourceParser */
     $this->operation = new Operations\RemoveValues($sourceInterpretation->getSource());
 }
Exemplo n.º 4
0
 public function interpretJoinOptions($isGroupJoin, ISourceInterpretation $sourceInterpretation, $defaultKeyId, $defaultValueId, array $defaultValueKeyPair = null)
 {
     /* @var $sourceInterpretation ISourceParser */
     $hasDefault = $defaultValueKeyPair !== null;
     $this->joinOptions = new Join\Options($sourceInterpretation->getSource(), $isGroupJoin, $this->joinFilter, $hasDefault, $hasDefault ? $defaultValueId : null, $hasDefault ? $defaultKeyId : null);
 }