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);
    }
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);
    }
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 ) ; }
Build and execute a flow query chain

@param array $chain
@return string
Build and execute a flow query chain