TreeBehavior::_ancestorIds PHP Méthode

_ancestorIds() protected méthode

Returns all the ancestor ids of the provided object id.
protected _ancestorIds ( CDbConnection $db, string $table, string $obj_id )
$db CDbConnection
$table string
$obj_id string
    protected function _ancestorIds($db, $table, $obj_id)
    {
        $limits = $this->_treeLimits($db, $table, $obj_id);
        $sql_strs = array();
        foreach ($limits as $l) {
            $sql_strs[] = $this->leftAttribute . ' < ' . $l[0] . ' AND ' . $this->rightAttribute . ' >  ' . $l[1];
        }
        $query = 'SELECT ' . $this->idAttribute . ' FROM ' . $table . ' WHERE (' . implode(') OR (', $sql_strs) . ')';
        $res = $db->createCommand($query)->query();
        $ids = array();
        foreach ($res as $r) {
            $ids[] = $r[$this->idAttribute];
        }
        return $ids;
    }