{@inheritdoc}

@param FlowQuery $flowQuery the FlowQuery object
@param array $arguments Ignored for this operation
@return void
775971
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $context = $flowQuery->getContext();
        if (count($context) > 0) {
            $flowQuery->setContext([end($context)]);
        } else {
            $flowQuery->setContext([]);
        }
    }
660875
public function process(ContainerBuilder $container)
    {
        $definition = $container->findDefinition(FlowManager::class);
        foreach ($this->flowsConfig as $flowTube => $flowConfigData) {
            $flowConfig = new FlowConfig($flowTube, $flowConfigData);
            $flowDefinition = new Definition(Flow::class);
            $flowDefinition->setAutowired(true);
            $flowDefinition->setArgument('$flowConfig', $flowConfig);
            try {
                $producerDefinition = $container->findDefinition($flowConfig->getProducerServiceId());
                $producerDefinition->setShared(false);

                $producerInstanceDefinition = new Definition();
                $producerInstanceDefinition
                    ->setAutowired(true)
                    ->setClass(ProducerInstance::class)
                    ->setArgument('$flowConfig', $flowConfig)
                    ->setArgument('$producer', new Reference($flowConfig->getProducerServiceId()))
                ;
                $flowDefinition->setArgument('$producerInstance', $producerInstanceDefinition);
            } catch (ServiceNotFoundException $e) {
                throw new InvalidConfigurationException(
                    sprintf(
                        'Invalid producer for flow "%s", there is no service defined with ID "%s".',
                        $flowConfig->getDescription(),
                        $flowConfig->getProducerServiceId()
                    )
                );
            }
            try {
                $workerDefinition = $container->findDefinition($flowConfig->getWorkerServiceId());
                $workerDefinition->setShared(false);
                $workerInstancesDefinitions = [];
                for ($instanceId = 1; $instanceId <= $flowConfig->getWorkerInstancesCount(); $instanceId++) {
                    $workerInstanceDefinition = new Definition();
                    $workerInstanceDefinition
                        ->setAutowired(true)
                        ->setClass(WorkerInstance::class)
                        ->setArgument('$flowConfig', $flowConfig)
                        ->setArgument('$instanceId', $instanceId)
                        ->setArgument('$worker', new Reference($flowConfig->getWorkerServiceId()))
                    ;
                    $workerInstancesDefinitions[] = $workerInstanceDefinition;
                }
                $flowDefinition->setArgument('$workerInstances', $workerInstancesDefinitions);
            } catch (ServiceNotFoundException $e) {
                throw new InvalidConfigurationException(
                    sprintf(
                        'Invalid workder for flow "%s", there is no service defined with ID "%s".',
                        $flowConfig->getDescription(),
                        $flowConfig->getWorkerServiceId()
                    )
                );
            }
            $container->setDefinition($flowTube, $flowDefinition);
            $definition->addMethodCall('addFlow', [new Reference($flowTube)]);
        }
    }
1334634
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $context = $flowQuery->getContext();
        if ($context instanceof \Iterator) {
            $context = iterator_to_array($context);
        }
        if (isset($arguments[0]) && isset($arguments[1])) {
            $context = array_slice($context, (integer)$arguments[0], (integer)$arguments[1] - (integer)$arguments[0]);
        } elseif (isset($arguments[0])) {
            $context = array_slice($context, (integer)$arguments[0]);
        }

        $flowQuery->setContext($context);
    }
131437
public function runWorkflow(int $workflowId, array $convos): void
    {
        Assert::notEmpty(
            $convos,
            'Conversations cannot be empty'
        );

        $conversations = new RunWorkflowRequest($convos);

        $uri = sprintf(self::RUN_WORKFLOW_URL, $workflowId);

        foreach ($conversations->getBatch() as $batch) {
            $this->restClient->createResource($batch, $uri);
        }
    }
865581
protected function setRange($arguments)
    {
        $this->query->setStart($this->getOffset($arguments));
        $this->query->setRows($this->getCount($arguments));
    }
1336313
public function passesCondition(TransientVarsInterface $transientVars, array $args = [], PropertySetInterface $ps)
    {
        $status = $args['status'];
        $stepId = array_key_exists('stepId', $args) ? (int)$args['stepId'] : 0;

        /** @var WorkflowEntryInterface $entry */
        $entry = $transientVars['entry'];

        /** @var WorkflowStoreInterface $store */
        $store = $transientVars['store'];
        $currentSteps = $store->findCurrentSteps($entry->getId());

        if ($stepId === 0) {
            foreach ($currentSteps as $step) {
                if ($status === $step->getStatus()) {
                    return true;
                }
            }
        } else {
            foreach ($currentSteps as $step) {
                if (($stepId === $step->getStepId())
                    && ($status === $step->getStatus())) {
                    return true;
                }
            }
        }

        return false;
    }
376431
public function execute(string $query, array $parameters = []): int
    {
        return $this->statement($query, $parameters)->rowCount();
    }
727661
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        if (!isset($arguments[0]) || empty($arguments[0])) {
            return;
        }

        if ($arguments[0] instanceof NodeInterface) {
            $filteredContext = [];
            $context = $flowQuery->getContext();
            foreach ($context as $element) {
                if ($element === $arguments[0]) {
                    $filteredContext[] = $element;
                    break;
                }
            }
            $flowQuery->setContext($filteredContext);
        } else {
            parent::evaluate($flowQuery, $arguments);
        }
    }
821514
public function run(Application $app, Request $request, array $arguments = [])
    {
        return $this->processRequest($app, $request, $this->callback, $arguments);
    }
1078424
public static <T> void invoke(List<QueryExprMeta> queries,
                                  QueryExprInvoker<T> invoker,
                                  ExprApplier<T> exprApplier) {
        for (QueryExprMeta expr : queries) {
            exprApplier.apply(invoker.invoke(expr));
        }
    }
234712
@SafeVarargs
  public final QueryBuilder arguments(Object...args) {
    set(Param.QUERY_ARGS, "");
    queryArgs = args.clone();
    return this;
  }
96399
public function flowQueryAction(array $chain)
    {
        $createContext = array_shift($chain);
        $finisher = array_pop($chain);

        $flowQuery = new FlowQuery(array_map(
            function ($envelope) {
                return $this->nodeService->getNodeFromContextPath($envelope['$node']);
            },
            $createContext['payload']
        ));

        foreach ($chain as $operation) {
            $flowQuery = call_user_func_array([$flowQuery, $operation['type']], $operation['payload']);
        }

        $nodeInfoHelper = new NodeInfoHelper();
        $result = [];
        switch ($finisher['type']) {
            case 'get':
                $result = $nodeInfoHelper->renderNodes($flowQuery->get(), $this->getControllerContext());
            break;
            case 'getForTree':
                $result = $nodeInfoHelper->renderNodes($flowQuery->get(), $this->getControllerContext(), true);
            break;
            case 'getForTreeWithParents':
                $result = $nodeInfoHelper->renderNodesWithParents($flowQuery->get(), $this->getControllerContext());
            break;
        }

        return json_encode($result);
    }
1185054
public function pushQuery($query, array $parameters = array())
    {
        $this->checkIfOpened();
        try {
            $response = $this->handleResponse($this->client->pushToTransaction($this->transactionId, $query, $parameters, $this->conn));
            $result = $response->getResult();
            $this->results[] = $result;

            return $result;
        } catch(HttpException $e) {
            $this->rollback();
            throw $e;
        }

    }
519146
public function resolveOperation($operationName, $context)
    {
        if (!isset($this->operations[$operationName])) {
            throw new FlowQueryException('Operation "' . $operationName . '" not found.', 1332491837);
        }

        foreach ($this->operations[$operationName] as $operationClassName) {
            /** @var OperationInterface $operation */
            $operation = $this->objectManager->get($operationClassName);
            if ($operation->canEvaluate($context)) {
                return $operation;
            }
        }
        throw new FlowQueryException('No operation which satisfies the runtime constraints found for "' . $operationName . '".', 1332491864);
    }
749961
private function applyConditions(QueryBuilder $query, array $conditions): void
    {
        foreach ($conditions as $identifier => $value) {
            $query->andWhere(
                $query->expr()->eq($identifier, ':' . $identifier)
            );

            $query->setParameter($identifier, $value, is_int($value) ? Type::INTEGER : Type::STRING);
        }
    }
893927
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $output = [];
        $outputNodePaths = [];
        foreach ($flowQuery->getContext() as $contextNode) {
            foreach ($this->getNextForNode($contextNode) as $nextNode) {
                if ($nextNode !== null && !isset($outputNodePaths[(string)$nextNode->findNodePath()])) {
                    $outputNodePaths[(string)$nextNode->findNodePath()] = true;
                    $output[] = $nextNode;
                }
            }
        }
        $flowQuery->setContext($output);

        if (isset($arguments[0]) && !empty($arguments[0])) {
            $flowQuery->pushOperation('filter', $arguments);
        }
    }
668419
public function sql($query, $args = []) {
		if (!is_string($query) || empty($query))
			throw new \InvalidArgumentException("Query is not a valid string");
	
		//open connection
		$this->driver->connect();
			
		//build statement
		$stmt = $this->driver->buildStatement($this->typeManager);
	
		//build query
		$query = $stmt->format($query, $args, $this->config);
		
		//invoke debug callback
		if ($this->hasOption('callback.debug')) {
			$callback = $this->getOption('callback.debug');
			if ($callback instanceof \Closure)
				$callback->__invoke($query);
		}
		
		//run query
		$result = $this->driver->query($query);
	
		//check query execution
		if ($result === false)
			$this->driver->throwQueryException($stmt);
	
		return $result;
	}