Finds objects by UID, overrides the default one.

@param int $uid The UID
@param array $querySettings The optional query settings to apply
@return object|null The found object or null if no object was found
777057
public function findByUid($uid, array $querySettings = ['respectSysLanguage' => false]) {
    if ($uid && $uid > 0) {
      // Create a new query.
      $query = $this->createquery();

      // Apply the passed query settings.
      $query = $this->applyQuerySettings($query, $querySettings);

      // Set the query constraints.
      $query->matching($query->equals('uid', $uid));

      // Execute the query and get the first object.
      $result = $query->execute()->getFirst();

      return $result;
    }

    return null;
  }
773187
public function getQuery()
    {
        $idField = $this->documentKey;

        if ($idField == null) {
            throw new QueryException('id should not be null');
        }

        $this->setQuery(sprintf('id:%s', $idField));

        return parent::getQuery();
    }
50251
public function getQueryRewrites(ContainerConfigurationInterface $containerConfig, $queryText)
    {
        $cacheKey  = $this->getCacheKey($containerConfig, $queryText);
        $cacheTags = $this->getCacheTags($containerConfig);

        $queryRewrites = $this->cacheHelper->loadCache($cacheKey);

        if ($queryRewrites === false) {
            $queryRewrites = $this->computeQueryRewrites($containerConfig, $queryText);
            $this->cacheHelper->saveCache($cacheKey, $queryRewrites, $cacheTags);
        }

        return $queryRewrites;
    }
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;
    }
507280
public function findByIds(array $ids)
    {
        $entities = [];

        for ($i = 0; $i < count($this->registries); $i++) {
            /** @var RegistryInterface $registry */
            $registry = $this->registries[ $i ];
            $found = $registry->findByKeys($ids);
            $entities = array_merge($entities, $found);

            $this->updateRegistries($found, $i - 1);

            if (count($entities) === count($ids)) {
                break;
            }
        }

        return $entities;
    }
25701
function getQueryArgs (ids) {
    // build query args
    var queryArgs = {
        allow: this.query.args.allow,
        session: this.query.session,
        where: {},
    }
    // set ids for query
    queryArgs.where[this.idColumn] = ids
    // if query is for list of ids set all flag
    if (Array.isArray(ids)) {
        queryArgs.all = true
    }
    // otherwise set limit 1
    else {
        queryArgs.limit = 1
    }
    // if query is for original id then set current flag
    if (this.isOriginalId) {
        queryArgs.current = true
    }
    // if custom query args are set then merge
    if (typeof this.queryArgs === 'object') {
        _.merge(queryArgs, this.queryArgs)
    }

    return queryArgs
}
1183370
public function queryEnd($queryId)
    {
        // Don't do anything if the Zend_Db_Profiler is not enabled.
        if (!$this->_enabled) {
            return self::IGNORED;
        }

        // Check for a valid query handle.
        if (!isset($this->_queryProfiles[$queryId])) {
            /**
             * @see Zend_Db_Profiler_Exception
             */
            // require_once 'Zend/Db/Profiler/Exception.php';
            throw new Zend_Db_Profiler_Exception("Profiler has no query with handle '$queryId'.");
        }

        $qp = $this->_queryProfiles[$queryId];

        // Ensure that the query profile has not already ended
        if ($qp->hasEnded()) {
            /**
             * @see Zend_Db_Profiler_Exception
             */
            // require_once 'Zend/Db/Profiler/Exception.php';
            throw new Zend_Db_Profiler_Exception("Query with profiler handle '$queryId' has already ended.");
        }

        // End the query profile so that the elapsed time can be calculated.
        $qp->end();

        /**
         * If filtering by elapsed time is enabled, only keep the profile if
         * it ran for the minimum time.
         */
        if (null !== $this->_filterElapsedSecs && $qp->getElapsedSecs() < $this->_filterElapsedSecs) {
            unset($this->_queryProfiles[$queryId]);
            return self::IGNORED;
        }

        /**
         * If filtering by query type is enabled, only keep the query if
         * it was one of the allowed types.
         */
        if (null !== $this->_filterTypes && !($qp->getQueryType() & $this->_filterTypes)) {
            unset($this->_queryProfiles[$queryId]);
            return self::IGNORED;
        }

        return self::STORED;
    }
261906
private function fillQueryData($queryIds)
    {
        $data = [];

        $collection  = $this->queryCollection->addFieldToFilter('query_id', $queryIds);
        $yesNoValues = $this->yesNo->toArray();

        foreach ($collection as $query) {
            $data[] = [
                'id'              => $query->getId(),
                'query_text'      => $query->getQueryText(),
                'is_spellchecked' => $yesNoValues[(int) $query->getIsSpellchecked()],
            ];
        }

        return $data;
    }
1142772
public function queryCollection($collectionGuid, $options = [])
    {
        $options['guid'] = $collectionGuid;
        return $this->_request(self::QUERY_COLLECTION, $options);
    }
1087419
public function getRuleData($uid) {

        if (empty($this->ruleData) && !empty($uid)){

            $rule_data = $this->config['auth_cache'] ? Cache::get($this->getRuleKey($uid)) : [];


            if (empty($rule_data) || !is_array($rule_data)){

                $join = '__AUTH_RULE__ b';

                $where = [];
                $groups = $this->getRoleUser($uid);
                $where['a.role_id'] = ['in',$groups];

                $where['b.status'] = 1;

                $rule_data = Db::name('auth_access')->alias("a")
                    ->field('b.name,b.condition')
                    ->join($join,'a.rule_name = b.name')
                    ->where($where)
                    ->select();

                if (empty($rule_data)) return false;

                if ($this->config['auth_cache'])
                    Cache::set($this->getRuleKey($uid),$rule_data);

            }

            $this->ruleData = $rule_data;

        }

        return $this->ruleData;
    }
1186377
public static function unsetInvalidGUIDs($guids)
    {
        foreach ($guids as $key => $guid)
        {
            if (!preg_match(self::GUID_REGEX, $guid)){
                unset($guids[$key]);
            }
        }
        return $guids;
    }
1305709
public function getMessages($uid=null, $filters=array())
	{
		$uid = $uid ?: $this->uid;

		if (!$uid)
		{
			return array();
		}

		$r = $this->getTableName();
		$m = Message::blank()->getTableName();
		$s = Seen::blank()->getTableName();

		$entries = $this->buildQuery($uid, $filters);

		return $entries
			->select($m . '.*,' . $r . '.expires,' . $r . '.actionid,' . $r . '.state,' . $s . '.whenseen')
			->order($r . '.created', 'desc')
			->limit($filters['limit'])
			->start($filters['start'])
			->rows();
	}
867406
public function buildRecordQuery($type, $uid, $pageId): Query
    {
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
        $site = $siteRepository->getSiteByPageId($pageId);

        return $this->newSearchQuery('')
            ->useQueryString('*:*')
            ->useFilter('type:' . $type . ' AND uid:' . $uid, 'type')
            ->useFilter('siteHash:' . $site->getSiteHash(), 'siteHash')
            ->useReturnFields(ReturnFields::fromString('*'))
            ->useSortings(Sortings::fromString('type asc, title asc'))
            ->useQueryType('standard')
            ->getQuery();
    }
862448
public function getByUID($uid)
    {
        return array_filter($this->getComponents(), function ($item) use ($uid) {
            if (!$itemUid = $item->select('UID')) {
                return false;
            }
            $itemUid = current($itemUid)->getValue();

            return $uid === $itemUid;
        });
    }
162787
public function findByGuid($guid, $columns = [])
    {
        try {
            return $this->findByGuidOrFail($guid, $columns);
        } catch (ModelNotFoundException $e) {
            return false;
        }
    }
1206939
protected function getBaseUser($uid)
    {
        $query = "SELECT email, password, isactive FROM {$this->config->table_users} WHERE id = :id";
        $query_prepared = $this->dbh->prepare($query);
        $query_prepared->execute(['id' => $uid]);

        $data = $query_prepared->fetch(\PDO::FETCH_ASSOC);

        if (!$data) {
            return false;
        }

        $data['uid'] = $uid;

        return $data;
    }
1003271
private function getIds(
        $collection = null,
        $systemCollections = true,
        $types = null,
        $search = null,
        $orderBy = null,
        $orderSort = null,
        $limit = null,
        $offset = null
    ) {
        $subQuery = $this->getIdsQuery(
            $collection,
            $systemCollections,
            $types,
            $search,
            $orderBy,
            $orderSort,
            $limit,
            $offset
        );

        return $subQuery->getScalarResult();
    }