public function selectAsArray($withMaxPermissions = false, $withLastOpenDate = false)
    {
        $this->init();
        $this->resultAsArray = true;
        $this->joinSingleRelatives = true;
        $eol = PHP_EOL;
        $this->selectClause =
            "SELECT DISTINCT{$eol}".
            "    node.id as id,{$eol}".
            "    node.uuid as uuid,{$eol}".
            "    node.name as name,{$eol}".
            "    node.path as path,{$eol}".
            "    IDENTITY(node.parent) as parent_id,{$eol}".
            "    creator.username as creator_username,{$eol}".
            "    creator.id as creator_id,{$eol}".
            "    resourceType.name as type,{$eol}".
            "    icon.relativeUrl as large_icon,{$eol}".
            "    node.mimeType as mime_type,{$eol}".
            "    node.index as index_dir,{$eol}".
            "    node.creationDate as creation_date,{$eol}".
            "    node.modificationDate as modification_date,{$eol}".
            "    node.published as published,{$eol}".
            "    node.accessibleFrom as accessible_from,{$eol}".
            "    node.accessibleUntil as accessible_until,{$eol}".
            "    node.deletable as deletable{$eol}";

        if ($withMaxPermissions) {
            $this->leftJoinRights = true;
            $this->selectClause .= ",{$eol}rights.mask";
        }

        if ($withLastOpenDate) {
            $this->leftJoinLogs = true;
            $this->selectClause .= ",{$eol}log.dateLog as last_opened";
        }

        $this->selectClause .= $eol;

        return $this;
    }