Paradox/toolbox/TransactionManager.php
private function processResult($results)
    {
        $processedResults = array();

        foreach ($results as $id => $result) {

            $command = $this->_commands[$id];

            switch ($command['action']) {

                case "PodManager:store":
                    $processed = $this->_toolbox->getPodManager()->processStoreResult($command['object']->getPod(), $result['_rev'], $result['_id']);
                    break;

                case "PodManager:delete":
                    $this->_toolbox->getPodManager()->processDeleteResult($command['object']->getPod());
                    $processed = true;
                    break;

                case "PodManager:load":

                    $parsedId = $this->_toolbox->parseId($result['_id']);

                    if (!$result) {
                        $processed = null;
                        break;
                    }

                    $processed = $this->_toolbox->getPodManager()->convertArrayToPod($command['data']['type'], $result);
                    break;

                case "Query:getOne":
                case "Query:getAll":
                    $processed = $result;
                    break;

                case "Finder:find":
                case "Finder:findAll":
                case "Finder:findNear":
                case "Finder:findAllNear":
                case "Finder:findWithin":
                case "Finder:findAllWithin":
                case "Finder:search":
                case "Finder:searchAll":
                    if (isset($command['data']['coordinates'])) {
                        $processed = $this->_toolbox->getFinder()->convertToPods($command['data']['type'], $result, $command['data']['coordinates']);
                    } else {
                        $processed = $this->_toolbox->getFinder()->convertToPods($command['data']['type'], $result);
                    }

                    break;

                case "Finder:findOne":
                case "Finder:any":
                case "Finder:findOneNear":
                case "Finder:findOneWithin":
                case "Finder:searchForOne":

                    if ($result == null) {
                        $processed = null;
                        break;
                    }

                    if (isset($command['data']['coordinates'])) {
                        $processed = $this->_toolbox->getFinder()->convertToPods($command['data']['type'], array($result), $command['data']['coordinates']);
                    } else {
                        $processed = $this->_toolbox->getFinder()->convertToPods($command['data']['type'], array($result));
                    }

                    $processed = reset($processed);

                    break;

                case "GraphManager:getInboundEdges":
                case "GraphManager:getOutboundEdges":
                case "GraphManager:getEdges":
                    $processed = $this->_toolbox->getGraphManager()->convertToPods("edge", $result);
                    break;

                case "GraphManager:getNeighbours":
                    $processed = $this->_toolbox->getGraphManager()->convertToPods("vertex", $result);
                    break;

                default:
                    throw new TransactionManagerException("Invalid or unimplemented action ({$command['action']}) while processing the transaction results.");
            }

            if (array_key_exists($id, $this->_registeredResults)) {
                $processedResults[$this->_registeredResults[$id]] = $processed;
            }
        }

        return $processedResults;
    }
private function processResult($results)
    {
        $processedResults = array();

        foreach ($results as $id => $result) {

            $command = $this->_commands[$id];

            switch ($command['action']) {

                case "PodManager:store":
                    $processed = $this->_toolbox->getPodManager()->processStoreResult($command['object']->getPod(), $result['_rev'], $result['_id']);
                    break;

                case "PodManager:delete":
                    $this->_toolbox->getPodManager()->processDeleteResult($command['object']->getPod());
                    $processed = true;
                    break;

                case "PodManager:load":

                    $parsedId = $this->_toolbox->parseId($result['_id']);

                    if (!$result) {
                        $processed = null;
                        break;
                    }

                    $processed = $this->_toolbox->getPodManager()->convertArrayToPod($command['data']['type'], $result);
                    break;

                case "Query:getOne":
                case "Query:getAll":
                    $processed = $result;
                    break;

                case "Finder:find":
                case "Finder:findAll":
                case "Finder:findNear":
                case "Finder:findAllNear":
                case "Finder:findWithin":
                case "Finder:findAllWithin":
                case "Finder:search":
                case "Finder:searchAll":
                    if (isset($command['data']['coordinates'])) {
                        $processed = $this->_toolbox->getFinder()->convertToPods($command['data']['type'], $result, $command['data']['coordinates']);
                    } else {
                        $processed = $this->_toolbox->getFinder()->convertToPods($command['data']['type'], $result);
                    }

                    break;

                case "Finder:findOne":
                case "Finder:any":
                case "Finder:findOneNear":
                case "Finder:findOneWithin":
                case "Finder:searchForOne":

                    if ($result == null) {
                        $processed = null;
                        break;
                    }

                    if (isset($command['data']['coordinates'])) {
                        $processed = $this->_toolbox->getFinder()->convertToPods($command['data']['type'], array($result), $command['data']['coordinates']);
                    } else {
                        $processed = $this->_toolbox->getFinder()->convertToPods($command['data']['type'], array($result));
                    }

                    $processed = reset($processed);

                    break;

                case "GraphManager:getInboundEdges":
                case "GraphManager:getOutboundEdges":
                case "GraphManager:getEdges":
                    $processed = $this->_toolbox->getGraphManager()->convertToPods("edge", $result);
                    break;

                case "GraphManager:getNeighbours":
                    $processed = $this->_toolbox->getGraphManager()->convertToPods("vertex", $result);
                    break;

                default:
                    throw new TransactionManagerException("Invalid or unimplemented action ({$command['action']}) while processing the transaction results.");
            }

            if (array_key_exists($id, $this->_registeredResults)) {
                $processedResults[$this->_registeredResults[$id]] = $processed;
            }
        }

        return $processedResults;
    }
Processes the transaction result after committing.
@param  array                       $results The results array from the server.
@throws TransactionManagerException
@return array