public function getSubtreeContent($sourceId, $onlyIds = false) { $query = $this->handler->createSelectQuery(); $query->select($onlyIds ? 'node_id, contentobject_id, depth' : '*')->from($this->handler->quoteTable('ezcontentobject_tree')); $this->applySubtreeLimitation($query, $sourceId); $query->orderBy($this->handler->quoteColumn('depth', 'ezcontentobject_tree'))->orderBy($this->handler->quoteColumn('node_id', 'ezcontentobject_tree')); $statement = $query->prepare(); $statement->execute(); $results = $statement->fetchAll($onlyIds ? PDO::FETCH_COLUMN | PDO::FETCH_GROUP : PDO::FETCH_ASSOC); // array_map() is used to to map all elements stored as $results[$i][0] to $results[$i] return $onlyIds ? array_map('reset', $results) : $results; }