src/Queries/UserQuery.php
protected function loadModels()
    {
        $queryType = 'UserQuery::getList';
        $sort = $this->sort;
        $filter = $this->normalizeFilter();
        $params = [
            'SELECT'     => $this->propsMustBeSelected() ? ['UF_*'] : ($this->normalizeUfSelect() ?: false),
            'NAV_PARAMS' => $this->navigation,
            'FIELDS'     => $this->normalizeSelect(),
        ];
        $selectGroups = $this->groupsMustBeSelected();
        $keyBy = $this->keyBy;

        $callback = function() use ($sort, $filter, $params, $selectGroups){
            $users = [];
            $rsUsers = $this->bxObject->getList($sort, $sortOrder = false, $filter, $params);
            while ($arUser = $this->performFetchUsingSelectedMethod($rsUsers)) {
                if ($selectGroups) {
                    $arUser['GROUP_ID'] = $this->bxObject->getUserGroup($arUser['ID']);
                }
        
                $this->addItemToResultsUsingKeyBy($users, new $this->modelName($arUser['ID'], $arUser));
            }
    
            return new Collection($users);
        };

        return $this->handleCacheIfNeeded(compact('queryType', 'sort', 'filter', 'params', 'selectGroups', 'keyBy'), $callback);
    }
protected function loadModels()
    {
        $queryType = 'UserQuery::getList';
        $sort = $this->sort;
        $filter = $this->normalizeFilter();
        $params = [
            'SELECT'     => $this->propsMustBeSelected() ? ['UF_*'] : ($this->normalizeUfSelect() ?: false),
            'NAV_PARAMS' => $this->navigation,
            'FIELDS'     => $this->normalizeSelect(),
        ];
        $selectGroups = $this->groupsMustBeSelected();
        $keyBy = $this->keyBy;

        $callback = function() use ($sort, $filter, $params, $selectGroups){
            $users = [];
            $rsUsers = $this->bxObject->getList($sort, $sortOrder = false, $filter, $params);
            while ($arUser = $this->performFetchUsingSelectedMethod($rsUsers)) {
                if ($selectGroups) {
                    $arUser['GROUP_ID'] = $this->bxObject->getUserGroup($arUser['ID']);
                }
        
                $this->addItemToResultsUsingKeyBy($users, new $this->modelName($arUser['ID'], $arUser));
            }
    
            return new Collection($users);
        };

        return $this->handleCacheIfNeeded(compact('queryType', 'sort', 'filter', 'params', 'selectGroups', 'keyBy'), $callback);
    }
Get the collection of users according to the current query.

@return Collection