Airship\Cabin\Bridge\Blueprint\Blog::getSeriesTree PHP Method

getSeriesTree() public method

Get a full series tree, recursively, from a given parent
public getSeriesTree ( integer $current = null, string $col = 'children', array $encountered = [], integer $depth ) : array
$current integer
$col string The "children" column name
$encountered array Which IDs have we seen before?
$depth integer How deep are we?
return array
    public function getSeriesTree($current = null, string $col = 'children', array $encountered = [], int $depth = 0) : array
    {
        if ($depth > 100) {
            return [];
        }
        $this->db->run(\Airship\queryString('blog.series.tree', ['valueset' => $this->db->escapeValueSet($encountered, 'int')]), $current);
        if (empty($rows)) {
            return [];
        }
        foreach ($rows as $i => $row) {
            $rows[$i][$col] = $this->getSeriesTree((int) $row['seriesid'], $col, $depth + 1);
        }
        return $rows;
    }