@param Filter $filter
@param int    $limit
@param int    $offset
@param string $order

@return Message[]
333220
public function findByFilter(Filter $filter, $limit = null, $offset = 0, $order = null)
    {
        return $this->findByCriteria($filter->getCriteria(), $limit, $offset, $order);
    }
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();
	}
506524
public function getEntitiesBy(array $criteria = [], array $orders = [], $limit = null, $offset = null): array
    {
        $entities = $this->getRepository()->findBy($criteria, $orders, $limit, $offset);
        $this->prepareEntitesForGet($entities);

        return $entities;
    }
594637
public function list(int $offset = 0, int $limit = 10)
    {
        $params = [
            'offset' => $offset,
            'limit' => $limit,
        ];

        return $this->httpPostJson('wxa/get_store_list', $params);
    }
409304
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $criteria = array_merge($criteria, array("deleted" => false));

        return parent::findBy($criteria, $orderBy, $limit, $offset);
    }
573567
public function getNotifications($limit = null, $order = 'desc')
    {
        $query = $this->getNotificationRelation()->orderBy('created_at', $order);
        if (! is_null($limit)) {
            $query->limit($limit);
        }

        return $query->get();
    }
1242178
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $query = $this->createQueryBuilder($criteria, $orderBy, $limit, $offset);
        return $this->getResultFromQueryBuilder($query);
    }
100615
public function parse(array $criteria, array $orderBy = array(), $limit = null, $offset = null)
    {
        $statement = new Expr\Statement();

        if(!empty($criteria)) {
            $statement->setClause('condition', $this->parseCriteria($criteria));
        }

        if(!empty($orderBy)) 
            $statement->setClause('order', $this->parseOrderBy($orderBy));
        if($limit)
            $statement->setClause('limit', $this->parseLimit($limit));
        if($offset)
            $statement->setClause('offset', $this->parseOffset($offset));

        return new Query($statement, $this->persister);
    }
971796
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $this->preFindBy($criteria);

        $result =  $this->doFindBy($criteria, $orderBy, $limit, $offset);
        $result = $this->postFindBy($result);

        return $result;
    }
1079709
private function filterAndSortByEncryptedField(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $encryptedSort = $this->orderByHasEncryptedField($orderBy);

        $encryptedFields = $this->getEncryptedFields();
        $notEncryptedCriteria = array_diff_key($criteria, $encryptedFields);
        $notEncryptedOrderBy = !$encryptedSort ? $orderBy : null;

        // Get the result of the filter by not encrypted fields
        $result = $this->wrapped->findBy($notEncryptedCriteria, $notEncryptedOrderBy);

        $encryptedCriteria = array_intersect_key($criteria, $encryptedFields);
        if (!empty($result) && !empty($encryptedCriteria)) {
            $result = $this->filterWithEncryptedCriteria($result, $encryptedCriteria);
        }

        if ($encryptedSort && !empty($orderBy)) {
            $result = $this->sortWithEncryptedOrderBy($result, $orderBy);
        }

        if ($limit) {
            $offset = $offset ? $offset : 0;

            $result = array_slice($result, $offset, $limit);
        }

        return $result;
    }
413827
private function getParamsFromFilter(FilterBuilder $filter)
    {
        $result  = [];
        $must    = [];
        $mustNot = [];

        $params = $filter->getParams();

        if ($params['entities']) {
            $result['index'] = $params['entities'];
        }

        if (isset($params['keyword'])) {
            $must[] = new MultiMatchQuery($params['keyword']['value'], $params['keyword']['fields']);
        }

        foreach ($params['params'] ?? [] as $param) {
            list($query, $operator) = $param->createFilter();

            if ($operator == FilterOperators::IN) {
                $must[] = $query;
            } else {
                $mustNot[] = $query;
            }

        }

        if ($mustNot || $must) {

            $query = new QueryBuilder();
            if ($mustNot) {
                $query->setMustNot(new MustNotQuery($mustNot));
            }
            if ($must) {
                $query->setMust(new MustQuery($must));
            }

            $result['query'] = $query->toArray();
        }

        return $result;
    }
337962
public function getLists($offset = 0, $limit = 100)
	{
		$lists = [];
		foreach ($this->client->get("lists?offset={$offset}&limit={$limit}") as $list) {
			$lists[] = new Resources\MailingList($this, $list);
		}
		return $lists;
	}
556286
public function fetchAll(Closure $filter = null, Closure $sort = null, int $limit = null, int $offset = 0): array
    {
        $collectionData = $this->storage->load(false);
        if (!isset($collectionData['items'])) {
            $collectionData['items'] = [];
        }
        $items = &$collectionData['items'];
        if ($sort) {
            \uasort($items, $sort);
        }
        if ($filter) {
            $items = \array_filter($items, $filter);
        }
        if ((int)$limit > 0) {
            $items = \array_slice($items, $offset, $limit);
        }
        return \array_values($items);
    }
846183
public function getSentMessages($filters=array())
	{
		$entries = $this->buildQuery($filters);
		$entries->order($entries->getTableName() . '.created', 'desc');

		if (isset($filters['limit']) && $filters['limit'] != 0)
		{
			$entries->limit($filters['limit'])
				->start($filters['start']);
		}

		return $entries->rows();
	}
694176
public function listFilesInFolder($folder, array $filter = null, array $sortOrder = null, array $limit = null) {
		$timeStamp = microtime(true);
		$response = $this->getFileUploadFolder($folder);
		if($response->error->exist){
			return $response;
		}
		$folder = $response->result->set;
        $filter[] = array(
            'glue' => ' and',
            'condition' => array(
                'column' => $this->entity['f']['alias'] . '.file_upload_folder',
                'comparison' => '=',
                'value' => $folder->getId())
        );
        $response = $this->listFiles($filter, $sortOrder, $limit);

		$response->stats->execution->start = $timeStamp;
		$response->stats->execution->end = microtime(true);

		return $response;
    }
1319842
public function loadAllLocations(int $offset = 0, int $limit = 25): array
    {
        return $this->service->loadAllLocations($offset, $limit);
    }
1136556
public Collection<Message> messages(MessageFilter filter) {
        return get(Message.class, (filter != null) ? filter : new MessageFilter());
    }