Get all ancestors of a term

@param int $id The term ID
@return \Illuminate\Support\Collection
179791
public function getAncestry($id)
    {
        $all_results = new Collection(DB::select($this->getAncestryInitialQuery(), [':id' => $id]));

        if (count($all_results)) {
            $this->getRecursiveAncestry($all_results, $all_results->lists('parent_id'));
        }

        return $all_results;
    }
1184275
public function loggedUser($id)
    {
        if (Podium::getInstance()->userComponent !== true) {
            return $this->andWhere(['inherited_id' => $id]);
        }
        return $this->andWhere(['id' => $id]);
    }
240343
public function getNumOfParent($id)
    {
        if ($parents = $this->qb
            ->table($this->table)
            ->select('id')
            ->where('id', $id)
            ->get()) {
            return $parents->count();
        }

        return 0;
    }
643212
public function get_ancestors() {
        global $DB;
        $ancestors = array();
        $ancestorsids = explode('/', trim($this->get('path'), '/'));
        // Drop the root item from the array /0/.
        array_shift($ancestorsids);
        if (!empty($ancestorsids)) {
            list($insql, $params) = $DB->get_in_or_equal($ancestorsids, SQL_PARAMS_NAMED);
            $ancestors = self::get_records_select("id $insql", $params);
        }
        return $ancestors;
    }
889993
public function getAncestryGraph($id)
    {
        $data = $this->getAncestry($id);

        if (count($data) == 0) {
            return [null, null];
        }

        // Create Vertices
        $this->vertices = $this->prepareVertices($data);

        // Create Graph
        $graph = new DirectedGraph();
        foreach ($this->vertices as $vertex) {
            $graph->add_vertex($vertex);
        }

        // Create Relations
        foreach ($data as $content) {
            $graph->create_edge($this->vertices[$content->parent_id], $this->vertices[$content->term_id]);
        }

        return [$this->vertices[$id], $graph];
    }
425469
public function parents($id)
    {
        $this->index();
        $result = array();
        while ($id)
        {
            foreach ($this->index as $key => $value)
            {
                if (in_array($id, $value))
                {
                    $result[] = $id = $key;
                    break;
                }
            }
            if (!$result)
            {
                return null;
            }
        }
        $result = array_reverse($result);
        return $result;
    }
503899
public function getHistorySteps($id)
    {
        try {
            $store = $this->getPersistence();

            return $store->findHistorySteps($id);
        } catch (StoreException $e) {
            $errMsg = sprintf(
                'Ошибка при получение истории шагов для экземпляра workflow c id# %s',
                $id
            );
            $this->getLog()->error($errMsg, [$e]);
        }

        return [];
    }
1290834
protected function doContains($id)
    {
        $found = false;
        $this->delegate->get($id, null, $found);
        return $found;
    }
1325216
public function findOneById($id)
    {
        $id = $this->idToMongo($id);

        if ($this->identityMap->has($id)) {
            return $this->identityMap->get($id);
        }

        return $this->createQuery(array('_id' => $id))->one();
    }
43655
public function get( $id ) {
		if ( isset( $this->types[ $id ] ) ) {
			return $this->types[ $id ];
		}

		return null;
	}
347408
public function getHierarchy($id)
    {
        $url = $this->buildUrlByMethodName(
            'getGetHierarchyUrl',
            ['id' => $id]
        );

        return $this
            ->buildLocations(
                $this->resolveApiUrl($url)
            );
    }
922297
public function findRootOf( $id )
    {
        return $this->findOne( array(
            'id' => $this->sql()
                         ->select()
                         ->columns( array( 'rootId' ) )
                         ->where( array(
                             'id' => $id,
                         ) ),
        ) );
    }
749913
public function all($id = null)
    {
        if (!is_int($id)) {
            return $this->get('/repositories');
        }

        return $this->get('/repositories?since='.rawurldecode($id));
    }
997155
public function getTree($id = null) {
        $parent = $this->getConfig('parentField');
        $left = $this->getConfig('leftField');
        $right = $this->getConfig('rightField');

        $query = $this->getRepository()->select()->orderBy($left, 'asc');

        if ($id) {
            if ($parentNode = $this->getNode($id)) {
                $query->where($left, 'between', [$parentNode[$left], $parentNode[$right]]);
            } else {
                return [];
            }
        }

        $nodes = $query->all();

        if ($nodes->isEmpty()) {
            return [];
        }

        $map = [];
        $stack = [];
        $pk = $this->getRepository()->getPrimaryKey();

        foreach ($nodes as $node) {
            if ($node[$parent] && $node[$pk] != $id) {
                $map[$node[$parent]][] = $node;
            } else {
                $stack[] = $node;
            }
        }

        $results = $this->mapTree($stack, $map);

        if ($id) {
            return $results[0];
        }

        return $results;
    }
643638
public function getChildren($id)
    {
        $url = $this->buildUrlByMethodName(
            'getGetChildrenUrl',
            ['id' => $id]
        );

        return $this
            ->buildLocations(
                $this->resolveApiUrl($url)
            );
    }
1221547
public function getDescent($id)
    {
        $tbl = $this->hierarchyTable;
        $recursive = "SELECT c.term_id, c.parent_id from $tbl as c join :tmp_tbl as p on c.parent_id = p.term_id";

        $raw_query = $this->assembleQuery($this->getDescentInitialQuery(), $recursive);

        return $this->runQuery($raw_query, $id);
    }
844203
public function findParentNodesByChildId($id)
	{
        // To be returned
        $result = array();

        $rl = $this->getRelations();
        $data = $rl[RelationBuilder::TREE_PARAM_ITEMS];

        // If can't find, then return empty array
        if (!isset($data[$id])) {
            return array();
        }

        $current = $data[$id];
        $parentId = $current[RelationBuilder::TREE_PARAM_PARENT_ID];

        while (isset($data[$parentId])) {
            $current = $data[$parentId];
            $parentId = $current[RelationBuilder::TREE_PARAM_PARENT_ID];

            array_push($result, $current);
        }

        return $result;
    }