Builds a category's rootline of parent category Ids

@param int $uid The category ID to build the rootline for
@return array Category ID rootline as array
166118
protected function buildCategoryIdRootline($uid)
    {
        $rootlineIds = [];
        $parentCategory = intval($uid);

        while ($parentCategory !== 0) {
            $rootlineIds[] = $parentCategory;
            $childCategory = $this->systemCategoryRepository->findOneByUid($parentCategory);
            if ($childCategory === null) {
                $parentCategory = 0;
            } else {
                $parentCategory = intval($childCategory['parent']);
            }
        }
        krsort($rootlineIds);

        return array_values($rootlineIds);
    }
1272482
protected function buildPageIdRootline($pageId, $mountPoint = '')
    {
        $rootlinePageIds = [];

            /** @var $pageSelector PageRepository */
        $pageSelector = GeneralUtility::makeInstance(PageRepository::class);
        $rootline = $pageSelector->getRootLine($pageId, (string)$mountPoint);

        foreach ($rootline as $page) {
            if (Site::isRootPage($page)) {
                break;
            }

            array_unshift($rootlinePageIds, $page['pid']);
        }

        $rootlinePageIds[] = $pageId;

        return $rootlinePageIds;
    }
982770
protected function kickUid($uid)
    {
        if (Start::$testUnity) {
            $this->testUnitSendStack[] = ['action' => 'kickUid', 'uid' => $uid];
        } else {
            get_instance()->kickUid($uid);
        }
    }
869787
private function getFilter($uid)
    {
        if (isset($this->filters[$uid])) {
            return $this->filters[$uid];
        }

        $entry = $this->cache->get($this->getCacheId($uid));

        if ($entry && $entry->data instanceof BloomFilter) {
            return $this->filters[$uid] = $entry->data;
        }

        return $this->filters[$uid] = $this->rebuildFilter($uid);
    }
187622
@Override
    public String buildRESTParentHierarchy(String pid)
            throws MelcoeXacmlException {
        Set<String> parents = getParents(pid);
        if (parents == null || parents.size() == 0) {
            return "/" + pid;
        }

        String[] parentArray = parents.toArray(new String[parents.size()]);

        return buildRESTParentHierarchy(parentArray[0]) + "/" + pid;
    }
905117
protected static function buildTree(&$data, $rootID = 0)
    {
        $tree = [];

        foreach ($data as $id => $node) {
            if ($node->parentId == $rootID) {
                unset($data[$id]);
                $node->children = self::buildTree($data, $node->id);
                $tree[] = $node;
            }
        }

        return $tree;
    }
1086925
public function uid(string $uid): Builder
    {
        $this->claims[Claims::USER_ID] = $uid;

        return $this;
    }
191644
public function getUidInfo($uid)
    {
        $fd = $this->getFdFromUid($uid);
        if (empty($fd)) {
            if (!$this->isCluster()) {
                return [];
            } else {
                $fdInfo = ProcessManager::getInstance()->getRpcCall(ClusterProcess::class)->my_getUidInfo($uid);

                return $fdInfo;
            }
        } else {
            $fdInfo = $this->getFdInfo($fd);
            $fdInfo['node'] = getNodeName();

            return $fdInfo;
        }
    }
722460
public function buildCategoryTree()
    {
        $categories = $this
            ->categoryRepository
            ->getAllCategoriesSortedByParentAndPositionAsc();

        $categoryTree = [
            0 => null,
            'children' => [],
        ];

        /**
         * @var CategoryInterface $category
         */
        foreach ($categories as $category) {
            $parentCategoryId = 0;
            $categoryId = $category->getId();

            if (!$category->isRoot()) {
                if ($category->getParent() instanceof CategoryInterface) {
                    $parentCategoryId = $category->getParent()->getId();
                } else {

                    /**
                     * If category is not root and has no parent,
                     * don't insert it into the tree.
                     */
                    continue;
                }
            }

            if ($parentCategoryId && !isset($categoryTree[$parentCategoryId])) {
                $categoryTree[$parentCategoryId] = [
                    'entity' => null,
                    'children' => [],
                ];
            }

            if (!isset($categoryTree[$categoryId])) {
                $categoryTree[$categoryId] = [
                    'entity' => null,
                    'children' => [],
                ];
            }

            $categoryTree[$categoryId]['entity'] = $category;

            $categoryTree[$parentCategoryId]['children'][] = &$categoryTree[$categoryId];
        }

        return $categoryTree[0]['children']
            ?: [];
    }
588097
public function root()
    {
        $category = $this->createModel();

        $category = $category->whereExists(function($query)
        {
            $query->select(\DB::raw(1))
                  ->from('category_hierarchy')
                  ->whereRaw(DB::getTablePrefix().'categories.id = '.DB::getTablePrefix().'category_hierarchy.category_id')
                  ->where('category_hierarchy.category_parent_id', 0);
        });

        return $category;
    }
1111476
public static function getRootPid($uid = null)
    {
        static $cache = array();
        $ret = null;

        if ($uid === null) {
            #################
            # Current root PID
            #################
            $rootline = self::getRootLine();
            if (!empty($rootline[0])) {
                $ret = $rootline[0]['uid'];
            }
        } else {
            #################
            # Other root PID
            #################
            if (!isset($cache[$uid])) {
                $cache[$uid] = null;
                $rootline    = self::getRootLine($uid);

                if (!empty($rootline[0])) {
                    $cache[$uid] = $rootline[0]['uid'];
                }
            }

            $ret = $cache[$uid];
        }

        return $ret;
    }
668413
protected static function findHierarchy($vid, $parentID = false)
    {
        if (! isset(static::$_hierarchy[$vid][$parentID])) {
            $condition = ['vid' => $vid];

            if (is_numeric($parentID)) {
                $condition['parent_id'] = $parentID;
            }

            static::$_hierarchy[$vid][$parentID] = (new Query)
                ->from(static::tableName())
                ->where($condition)
                ->all();
        }

        return static::$_hierarchy[$vid][$parentID];
    }
437456
public function getGroupIds($uid){
        
        $groupIds = Db::table($this->dbTablePrefix . $this->tableUserGroup)
                    ->where('user_id',$uid)
                    ->column('group_id');
        
        return $groupIds;
    }
1333556
public function getAllGroupsForUser($uid) {
    $groups = &drupal_static(__FUNCTION__);

    // Get the memberships for the user if they aren't known yet.
    if (!isset($groups[$uid])) {
      $group_content_types = GroupContentType::loadByEntityTypeId('user');
      $group_content_types = array_keys($group_content_types);

      $query = $this->database->select('group_content_field_data', 'gcfd');
      $query->addField('gcfd', 'gid');
      $query->condition('gcfd.entity_id', $uid);
      $query->condition('gcfd.type', $group_content_types, 'IN');
      $query->execute()->fetchAll();

      $group_ids = $query->execute()->fetchAllAssoc('gid');
      $groups[$uid] = array_keys($group_ids);
    }

    return $groups[$uid];
  }
31774
public function getRuleIds($uid){
        
        $groups = $this->getGroup($uid);
        
        $rules = [];
        foreach ($groups as $g){
            $rule = $g['rules'] ? explode(',', $g['rules']) : '';
            if ($rule){
                $rules = array_merge($rules , $rule);
            } 
        }
        
        return $rules;
    }
1014224
public function getChildren($parentID)
    {
        $tmp = [];
        foreach($this->categoryList as $key => $item){
            if($item->parentID == $parentID) {
                $tmp[] = $item;
            }
        }

        return $tmp;
    }
1124172
public function buildFromTypeAndUid($type, $uid)
    {
        $systemHash = $this->getSystemHash();
        $variantId = $systemHash . '/' . $type . '/' . $uid;

        $variantId = $this->applyHook($variantId, $systemHash, $type, $uid);
        return $variantId;
    }