Find all.
@param  any       $query
@param  array     $queryParams
@param  array|int $limit
@return Oppa\ActiveRecord\EntityCollection
486977
public final function findAll($query = null, array $queryParams = null, $limit = null): EntityCollection
    {
        $queryBuilder = new QueryBuilder($this->db->getLink());
        $queryBuilder->setTable($this->table);

        $queryBuilder->select("{$this->table}.*");

        if (method_exists($this, 'onFind')) {
            $queryBuilder = $this->onFind($queryBuilder);
            if (!$queryBuilder || !($queryBuilder instanceof QueryBuilder)) {
                throw new InvalidValueException('You should return query builder back from onFind()!');
            }
        }

        $isEmptyQuery = empty($query);
        $isEmptyQueryParams = empty($queryParams);

        // fetch all rows, oh ohh..
        // e.g: findAll()
        if ($isEmptyQuery) {
            // nothing to do..
        }
        // fetch all rows by primary key with given params
        // e.g: findAll([1,2,3])
        elseif (!$isEmptyQuery && $isEmptyQueryParams) {
            $queryBuilder->where("{$this->table}.{$this->tablePrimary} IN(?)", [$query]);
        }
        // fetch all rows with given params and params
        // e.g: findAll('id IN (?)', [[1,2,3]])
        // e.g: findAll('id IN (?,?,?)', [1,2,3])
        elseif (!$isEmptyQuery && !$isEmptyQueryParams) {
            // now, it is user's responsibility to append table(s) before field(s)
            $queryBuilder->where($query, $queryParams);
        }

        @ [$limitStart, $limitStop] = (array) $limit;
        if ($limitStart !== null) {
            $queryBuilder->limit((int) $limitStart, $limitStop);
        }

        $hasOnEntity = method_exists($this, 'onEntity');

        $entityCollection = new EntityCollection();
        foreach ($queryBuilder->run() as $result) {
            $entity = new Entity($this, (array) $result);
            if ($hasOnEntity) {
                $this->onEntity($entity);
            }
            $entityCollection->addEntity($entity);
        }

        return $entityCollection;
    }
822675
protected function getAll(array $columns = [], $limit = - 1)
    {
        $query = [
            'TableName' => $this->getTable(),
        ];
        $op    = 'Scan';
        if ($limit > - 1) {
            $query['limit'] = $limit;
        }
        if ( ! empty( $columns )) {
            $query['AttributesToGet'] = $columns;
        }
        // If the $where is not empty, we run getIterator.
        if ( ! empty( $this->where )) {
            // Primary key or index key condition exists, then use Query instead of Scan.
            // However, Query only supports a few conditions.
            if ($key = $this->conditionsContainIndexKey()) {
                $condition = array_get($this->where, "$key.ComparisonOperator");
                if (ComparisonOperator::isValidQueryDynamoDbOperator($condition)) {
                    $op                     = 'Query';
                    $query['IndexName']     = $this->dynamoDbIndexKeys[$key];
                    $query['KeyConditions'] = $this->where;
                }
            }
            $query['ScanFilter'] = $this->where;
        }

        // Sorting.
        $query['ScanIndexForward'] = $this->scanIndexForward;

        $iterator = $this->client->getIterator($op, $query);
        $results  = [];
        foreach ($iterator as $item) {
            $item  = $this->unmarshalItem($item);
            $model = new static($item, static::$dynamoDb);
            $model->setUnfillableAttributes($item);
            $model->exists = true;
            $model->syncOriginal();

            $results[] = $model;
        }

        return new Collection($results);
    }
483908
public function findOneByParams(array $params = [])
    {
        $params['limit'] = 1;
        $records = $this->findByParams($params);
        if (count($records) > 0) {
            return $records->rewind();
        }

        return null;
    }
1283596
public function query($query, $params = [])
    {
        return $this->client->query($this->name, $query, $params);
    }
1168909
public function search(string $query, $limit = 30, $start = 0, $sort = null)
    {
        if ($query == '*.*' && $limit == 30 && $start == 0 && $sort == 'lastupdated desc') {
            $result = $this->fetchFromCache();

            if (null === $result) {
                $result = $this->search->search($query, $limit, $start, $sort);
                $this->saveToCache($result);
            }

            return $result;
        } else {
            return $this->search->search($query, $limit, $start, $sort);
        }
    }
1147436
public function queryProcessing($queryParams) 
    {
        list($this->query, $this->totalQuery, $this->filterQuery)
            = self::processQuery($this->query, $queryParams);

        $this->countTotal = Util::get($queryParams, 'countTotal', false);
        $this->countFilter = Util::get($queryParams, 'countFilter', false);

        return $this;
    }
1064265
public function many(string $condition = '', array $params = array(), $offset = null, $limit = null) {
        $this->model->builder
            ->select('*')
            ->from($this->model->tableName);

        if ($condition) {
            $this->model->builder->where($condition, $params);
        }

        if (null !== $offset) {
            if (null === $limit) {
                $this->model->builder->limit($offset);
            } else {
                $this->model->builder->limit($offset, $limit);
            }
        }
        $r = $this->model->builder->query();
        if (!is_array($r) || 0 === count($r)) {
            return [];
        }

        return $this->model->setup($r);
    }
1099650
public function getAll(QueryBuilder $qb, array $params = [], array $pageOpts = [], $inDeleted = false)
    {
        if ($this->softDelete && !$inDeleted) {
            $qb->andWhere('t.'.$this->softDeleteName.' IS NULL');
        }

        if (!empty($pageOpts)) {
            $rs = $this->paginate($qb, $pageOpts, $params);
        } else {
            $rs = $this->db->fetchAll($qb->getSQL(), $params);
        }

        return $rs;
    }
903226
public function search($params)
    {
        $query = Question::find()->orderBy(['created_at' => SORT_DESC]);

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'user_id' => $this->user_id,
            'price' => $this->price,
            'hide' => $this->hide,
            'answers' => $this->answers,
            'views' => $this->views,
            'followers' => $this->followers,
            'collections' => $this->collections,
            'comments' => $this->comments,
            'status' => $this->status,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ]);

        $query->andFilterWhere(['like', 'title', $this->title])
            ->andFilterWhere(['like', 'alias', $this->alias])
            ->andFilterWhere(['like', 'content', $this->content]);

        return $dataProvider;
    }
482168
public function query(
        Query $query,
        array $parameters = []
    ): Result {
        $resultingItems = $this->items[$this->getIndexKey()] ?? [];

        if (!empty($query->getFilters())) {
            foreach ($query->getFilters() as $filter) {
                if (Filter::TYPE_QUERY === $filter->getFilterType() && $filter->getValues() === ['']) {
                    continue;
                }

                if ('_id' !== $filter->getField()) {
                    throw new LogicException('Queries by field different than UUID not allowed in InMemoryRepository. Only for testing purposes.');
                }

                $resultingItems = [];
                $itemUUIDs = $filter->getValues();
                foreach ($itemUUIDs as $itemUUID) {
                    $resultingItems[$itemUUID] = $this->items[$this->getIndexKey()][$itemUUID] ?? null;
                }
            }
        }

        $resultingItems = array_values(
            array_slice(
                array_filter($resultingItems),
                $query->getFrom(),
                $query->getSize()
            )
        );

        $items = $this->items[$this->getIndexKey()] ?? [];
        $result = new Result($query->getUUID(), count($items), count($resultingItems));
        foreach ($resultingItems as $resultingItem) {
            $result->addItem($resultingItem);
        }

        return $result;
    }
54460
public function findFilter(Query $query, array $options)
    {
        foreach ($this->filters()->collection() as $name => $filter) {
            $filter->apply($query, $options);
        }

        return $query;
    }
1373099
public function search($params)
    {
        $query = Type::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'parent' => $this->parent,
        ]);

        $query->andFilterWhere(['like', 'name', $this->name])
            ->andFilterWhere(['like', 'module', $this->module]);

        return $dataProvider;
    }
698461
public function search($params)
    {
        /* @var $query ActiveQuery */

        $dataProvider = new ActiveDataProvider([
            'query' => $query = static::find(),
            'pagination' => [
                'pageSize' => StructureModule::module()->defaultPageSize,
            ],
        ]);
        if (null != $this->parent_id) {
            $query->andWhere(['parent_id' => $this->parent_id]);
        }
        if (null != $this->context_id) {
            $query->andWhere(['context_id' => $this->context_id]);
        }
        $dataProvider->sort->attributes['name'] = [
            'asc' => [StructureTranslation::tableName() . '.name' => SORT_ASC],
            'desc' => [StructureTranslation::tableName() . '.name' => SORT_DESC],
        ];
        $dataProvider->sort->attributes['title'] = [
            'asc' => [StructureTranslation::tableName() . '.title' => SORT_ASC],
            'desc' => [StructureTranslation::tableName() . '.title' => SORT_DESC],
        ];
        $dataProvider->sort->attributes['is_active'] = [
            'asc' => [StructureTranslation::tableName() . '.is_active' => SORT_ASC],
            'desc' => [StructureTranslation::tableName() . '.is_active' => SORT_DESC],
        ];
        $dataProvider->sort->attributes['slug'] = [
            'asc' => [StructureTranslation::tableName() . '.slug' => SORT_ASC],
            'desc' => [StructureTranslation::tableName() . '.slug' => SORT_DESC],
        ];
        if (false === $this->load($params)) {
            return $dataProvider;
        }
        $query->andFilterWhere(['id' => $this->id]);
        $query->andFilterWhere(['is_deleted' => $this->is_deleted]);
        $translation = new StructureTranslation();
        if (false === $translation->load(static::fetchParams($params, static::class, $translation))) {
            return $dataProvider;
        }
        $query->andFilterWhere(['like', StructureTranslation::tableName() . '.name', $this->name]);
        $query->andFilterWhere(['like', StructureTranslation::tableName() . '.title', $this->title]);
        $query->andFilterWhere(['like', StructureTranslation::tableName() . '.h1', $this->h1]);
        $query->andFilterWhere(['like', StructureTranslation::tableName() . '.slug', $this->slug]);
        $query->andFilterWhere([StructureTranslation::tableName() . '.is_active' => $this->is_active]);
        return $dataProvider;
    }
446520
public function paginate(Query $query, $page = 1, $limit = 10, $fetchJoinCollection = false): array
    {
        $paginator = new Paginator($query, $fetchJoinCollection);
        $totalItems = $paginator->count();
        $pagesCount = ceil($totalItems / $limit);
        $paginator
            ->getQuery()
            ->setFirstResult($limit * ($page - 1))// offset
            ->setMaxResults($limit); // limit

        return [
            'meta' => [
                'page' => $page,
                'total' => $totalItems,
                'pages' => $pagesCount,
                'limit' => $limit,
            ],
            'data' => $paginator
        ];
    }
1318790
public function getAll(array $queryParams = [])
    {
        $response = $this->api->settings()->getAll($queryParams);

        return new SettingsResponse($response);
    }
756417
public function getAll(array $queryParams = [])
    {
        $response = $this->api->languages()->getAll($queryParams);

        return new LanguagesResponse($response);
    }
1276881
public function getCustomList(QueryBuilder $queryBuilder, $start = 0, $limit = 0)
    {
        $parameters = array(
            'select' => $queryBuilder->getSelect(),
            'where'  => $queryBuilder->getWhere(),
            'order'  => $queryBuilder->getOrder(),
            'start'  => $start,
            'limit'  => $limit,
        );

        $parameters = array_filter($parameters);

        $supported = $this->isSupported('getList');

        return (true === $supported) ? $this->makeRequest($this->endpoint, $parameters) : $supported;
    }