Jackalope\Transport\DoctrineDBAL\Client::getNodesData PHP Method

getNodesData() private method

Build the raw data for a list of database result rows, fetching the additional information in one single query.
private getNodesData ( array $rows ) : stdClass[]
$rows array
return stdClass[]
    private function getNodesData($rows)
    {
        $data = array();
        $paths = array();
        foreach ($rows as $row) {
            $this->nodeIdentifiers[$row['path']] = $row['identifier'];
            $data[$row['path']] = $this->xmlToProps($row['props']);
            $data[$row['path']]->{'jcr:primaryType'} = $row['type'];
            $paths[] = $row['path'];
        }
        $query = 'SELECT path, parent FROM phpcr_nodes WHERE parent IN (?) AND workspace_name = ? ORDER BY sort_order ASC';
        if ($this->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
            $childrenRows = array();
            foreach (array_chunk($paths, self::SQLITE_MAXIMUM_IN_PARAM_COUNT) as $chunk) {
                $childrenRows += $this->getConnection()->fetchAll($query, array($chunk, $this->workspaceName), array(Connection::PARAM_STR_ARRAY, null));
            }
        } else {
            $childrenRows = $this->getConnection()->fetchAll($query, array($paths, $this->workspaceName), array(Connection::PARAM_STR_ARRAY, null));
        }
        foreach ($childrenRows as $child) {
            $childName = explode('/', $child['path']);
            $childName = end($childName);
            if (!isset($data[$child['parent']]->{$childName})) {
                $data[$child['parent']]->{$childName} = new \stdClass();
            }
        }
        foreach (array_keys($data) as $path) {
            // If the node is referenceable, return jcr:uuid.
            if (isset($data[$path]->{"jcr:mixinTypes"})) {
                foreach ((array) $data[$path]->{"jcr:mixinTypes"} as $mixin) {
                    if ($this->nodeTypeManager->getNodeType($mixin)->isNodeType('mix:referenceable')) {
                        $data[$path]->{'jcr:uuid'} = $this->nodeIdentifiers[$path];
                        break;
                    }
                }
            }
        }
        return $data;
    }