Get parents in order, the big boss first.
@param type $headId
@return type
973170
public function getParents($headId)
    {
        $head = $this->getNode($headId);
        $config = $this->config;
        $parents = $this->table()
                ->select(null)
                ->select("$config[id] AS id")
                ->where("$config[lft] < ?", $head['lft'])
                ->where("$config[rgt] > ?", $head['rgt'])
                ->where("$config[dpt] < ?", $head['dpt'])
                ->orderBy($config['lft'])
                ->fetchAll();

        return array_map(function($key) {
            return $key['id'];
        }, $parents);
    }
165262
public function getHierarchy($id)
    {
        $location = $this
            ->locationRepository
            ->findOneBy([
                'id' => $id,
            ]);

        if (empty($location)) {
            throw new EntityNotFoundException();
        }

        $parents = $location->getAllParents();
        $hierarchy = array_merge(
            $parents,
            [$location]
        );

        return $this->formatOutputLocationArray(
            $hierarchy
        );
    }
1373410
public function getAncestor($id)
    {
        if ( ! is_null($this->parent)) {
            if ($this->parent->id() == $id) {
                return $this->parent;
            }

            return $this->parent->getAncestor($id);
        }

        return null;
    }
193061
public function getRoot($folderId)
    {
        $folder = FolderQuery::create()->findPk($folderId);

        if (0 !== $folder->getParent()) {
            $parentFolder = FolderQuery::create()->findPk($folder->getParent());

            if (null !== $parentFolder) {
                $folderId = $this->getRoot($parentFolder->getId());
            }
        }

        return $folderId;
    }
841749
static public function parentIdAndType($id, $type = 'main')
    {
        $builder = self::where('parent_id', $id);
        $builder->where("is_$type", 1);
        $builder->where("is_hidden", 0);

        return $builder->orderBy("list_$type" . '_order')->get();
    }
1344361
public static function parentID($menuLinkID)
    {
        $parentIDs = [];
        while($menuLinkID != null){
            $parentObj = MenuLink::all()->where('menuLinkID', $menuLinkID)->first();
            if ($parentObj) {
                $menuLinkID = $parentObj->parent;
                if ($menuLinkID) {
                    $parentIDs[] = $menuLinkID;
                }
            }
            if ($parentObj || !$menuLinkID) {
                $menuLinkID = null;
            }
        }
        return $parentIDs;
    }
338958
public function getByParent( $parentId, $parentType, $config = [] ) {

		$modelClass	= static::$modelClass;

		return $modelClass::findByParent( $parentId, $parentType, $config );
	}
208925
public static function findByParentCartId( $parentId, $parentType, $orderId ) {

		return self::find()->where( 'parentId=:pid AND parentType=:ptype AND orderId=:oid', [ ':pid' => $parentId, ':ptype' => $parentType, ':oid' => $orderId ] )->one();
	}
1202551
public function getChildOrganizations($parentId = null)
    {
        static $children;

        if (is_null($parentId)) {
            return array();
        }

        if (! isset($children[$parentId])) {
            $organizations = $this->db->fetchPairs(
                    'SELECT gor_id_organization, gor_name
                        FROM gems__organizations
                        WHERE gor_active=1 AND gor_has_login=1 AND
                            (gor_accessible_by LIKE ' . $this->db->quote('%:' . $parentId . ':%') . ' OR
                                gor_id_organization = ' . $this->db->quote($parentId) .  ')
                            ORDER BY gor_name');

            natsort($organizations);

            $children[$parentId] = $organizations;
        }

        return $children[$parentId];
    }
216301
public function firstToken() {
    $head = $this->head;
    while ($head instanceof ParentNode) {
      $head = $head->head;
    }
    return $head;
  }
970153
function get_parent(){
		if( !is_null($this->pidx) && isset(self::$reg[$this->pidx]) ){
			return self::$reg[$this->pidx];
		}
		else {
			return null;
		}
	}
272337
public function getParentAll($id): Collection
    {
        $ids = $this->repo->find($id, ['path'])->toArray();

        return $this->repo->pushCriteria(new GetParentAll($ids))
            ->all();
    }
299080
public function head(string $uri)
    {
        $request = $this->getRequest($uri)
            ->setMethod('HEAD');

        return $this->send($request);
    }
814490
private function getChildrenIds($categoryId)
    {
        $parentChildMapping = $this->getParentChildMapping();
        if ('' === $categoryId) {
            $categoryId = self::PARENT_CHILD_MAPPING_LOOKUP_FOR_ROOT_NODES;
        }
        if (!isset($parentChildMapping[$categoryId])) {
            return array();
        }

        return $parentChildMapping[$categoryId];
    }
1137086
public function getFromId( $filterId){
        $rest = $this->getService( self::API_PARENTAL_FILTER . $filterId);
        $rest->GET();

        return $rest->getResult( models\ParentalControl\Filter::class);
    }
348462
public function getChildren($headId, $relativeDepth = null, $summarize = false)
    {
        $head = $this->getNode($headId);
        $config = $this->config;
        $query = $this->table()
                ->select(null)
                ->select("$config[id] AS id")
                ->where("$config[lft] > ?", $head['lft'])
                ->where("$config[rgt] < ?", $head['rgt']);

        if (!is_null($relativeDepth)) {
            $absoluteDepth = $relativeDepth + $head['dpt'];
            if ($summarize) {
                $query->where("$config[dpt] <= ?", $absoluteDepth);
            } else {
                $query->where("$config[dpt] = ?", $absoluteDepth);
            }
        }

        $children = $query->fetchAll();

        return array_map(function($key) {
            return $key['id'];
        }, $children);
    }
732825
public function head($uri)
	{
		$ch = $this->initializeRequest();

		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
		curl_setopt($ch, CURLOPT_URL, $uri);
		curl_setopt($ch, CURLOPT_NOBODY, true);
		curl_exec($ch);

		$this->checkResponse($ch);

		curl_close($ch);

		return $this;
	}