@param array $filter

@param int $limit
@param array $conditions

@return StorageDataRequest
495431
public function getSearchRequest($filter, $limit = 1, $conditions = [])
    {
        $db = $this->_getConnection();
        $table = $this->table;
        $self = $this;

        $request = new StorageDataRequest(
            [$filter, $limit],
            function ($filter, $limit) use ($db, $table, $self) {
                if (!$db) {
                    $self->logError('Missing connection on getSearchRequest on table: ' . $table);
                    return false;
                }
                
                //
                $filterBinds = [];
                foreach ($filter as $id => $filterItem) {
                    $filterBinds[$id] = $filterItem[2];  
                }
                //
                $filterBinds = $this->prepareBind($filterBinds, $db, false);
                //
                foreach ($filter as $id => &$filterItem) {
                    $filterItem[2] = $filterBinds[$id];
                } unset($filterItem);
                
                //
                $filtersWhereArray = $this->_prepapreFilters($filter);
                
                $query = 'SELECT * FROM ' . $table
                    . (!empty($filtersWhereArray) ? ' WHERE (' . implode(' ) AND (', $filtersWhereArray) . ')' : '')
                    . ' LIMIT '.$limit;

                $stmnt = $db->query($query);

                if (!$stmnt) {
                    $this->logError('Cannot execute getSearchRequest on table: ' . $table . ':' . implode(',', $db->errorInfo()), [
                        'code' => $db->errorCode(),
                    ]);

                    return false;
                }

                $result = $stmnt->fetchAll(PDO::FETCH_ASSOC);

                if (!$result && (int) $stmnt->errorCode() > 0) {
                    $this->logError('Error on execution on getSearchRequest on table: ' . $table . ':' . implode(',',
                            $stmnt->errorInfo()), [
                        'code' => $stmnt->errorCode(),
                    ]);

                    return false;
                }

                return $result;
            });

        return $request;
    }
1284559
public function findAll($start, $limit, $sortBy, $sortOrder = 'ASC', $params)
    {
        $query = count($params) ? $this->createFilterQuery($params) : new Query();
        $query->setFrom($start);

        // Sort & order
        $fieldName = (isset($sortBy['fieldName'])) ? $sortBy['fieldName'] : null;

        if ($fieldName !== null && $fieldName !== $this->modelIdentifier) {

            if (isset($this->fieldsMapping[$fieldName])) {
                $fieldName = $this->fieldsMapping[$fieldName];
            }
            $query->setSort(array($fieldName => array('order' => strtolower($sortOrder))));
        } else {
            $query->setSort(array(
                $this->modelIdentifier => array('order' => strtolower($sortOrder)),
            ));
        }

        // Custom filter for admin
        if(method_exists($this->admin, 'getExtraFilter')) {
            $query->setFilter($this->admin->getExtraFilter());
        }

        // Limit
        if ($limit === null) {
            $limit = 10000; // set to 0 does not seem to work
        }

        return $this->finder->find($query, $limit);
    }
1224430
public function deleteMany(array $filter, array $options = [])
    {
        list($bulkOptions, $options) = self::extractBulkWriteOptions($options);
        $model = new DeleteMany($filter, $options);
        $bulkWriteResult = $this->bulkWrite([$model], $bulkOptions);

        return new DeleteResult($bulkWriteResult);
    }
663912
private function fetchRangeIds($limit, $start)
    {
        $qb = $this->createFilterAndSortQueryBuilder();
        $qb->select(['t.id', 'e.latest_version']);

        if (null !== $limit) {
            $qb->setFirstResult($start);
            $qb->setMaxResults($limit);
        }

        $rows = $this->connection->fetchAll($qb->getSQL());

        $ids = [];
        foreach ($rows as $row) {
            $ids[$row['id']] = $row['latest_version'];
        }

        return $ids;
    }
242139
public function all($fields = null, $limit = null)
    {
        $result = $this->storage;

        if (isset($limit)) {
            $result = array_slice($this->storage, $limit);
        }

        if (empty($fields)) {
            return $this->result = new ArrayIterator($result);
        } else {
            $this->result = new ArrayIterator();

            foreach ($result as $row) {
                $item = new SplArrayObject();
                foreach ($fields as $field) {
                    if ($row->offsetExists($field)) {
                        $item[ $field ] = $row->offsetGet($field);
                    }
                }

                $this->result[] = $item;
            }

            return $this->result;
        }

        return false;
    }
423255
public function getByLimit(int $limit, array $where = [], array $with = [])
    {
        $query = $this->make($with);

        $query = $this->applyWhere($query, $where);

        return $query->take($limit)->get();
    }
1013669
public function filter($filter)
    {
        $callback = is_array($filter) ? $this->_filterFromArray($filter) : $filter;
        $data = array_filter($this->_data, $callback);
        return new static($data);
    }
228722
public function update($arr, $condition=null, $params=[], $filter=false) {
		if($condition) {
			$this->driver->where($condition, $params);
		}
		return $this->driver->update($arr);
	}
493803
public function listFilesWithType(string $type, array $filter = null, array $sortOrder = null, array $limit = null) {
		$timeStamp = microtime(true);
	    $typeOpts = array('a', 'i', 'v', 'f', 'd', 'p', 's', 'c');
        if(!in_array($type, $typeOpts)){
	        throw new InvalidFileTypeException($type);
		}
        $filter[] = array(
            'glue' => ' and',
            'condition' => array(
                'column' => $this->entity['f']['alias'] . '.type',
                'comparison' => '=',
                'value' => $type)
        );
        $response = $this->listFiles($filter, $sortOrder, $limit);

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

		return $response;
    }
333220
public function findByFilter(Filter $filter, $limit = null, $offset = 0, $order = null)
    {
        return $this->findByCriteria($filter->getCriteria(), $limit, $offset, $order);
    }
202103
public function sourceRecords($params, $sort, $limit)
    {
        if ($sort) {
            $parts = explode(' ', $sort);
            $field = $parts[0];
            $direction = $parts[1];
        }
        $filter = array(
            'Comments.ID:GreaterThan' => 0,
        );
        if (count($params) > 0 && isset($params['Title'])) {
            $filter['News.Title:PartialMatch'] = $params['Title'];
        }
        /** @var ArrayList|News[] $ret */
        $ret = News::get()->filter($filter);
        /** @var ArrayList $returnSet */
        $returnSet = ArrayList::create();
        if ($ret) {
            foreach ($ret as $record) {
                $record->Commentcount = $record->Comments()->count();
                $record->Spamcount = $record->Comments()->filter(array('AkismetMarked' => 1))->count();
                $record->Hiddencount = $record->Comments()->filter(array('AkismetMarked' => 0, 'Visible' => 0))->count();

                if (isset($params['Comment']) && $params['Comment'] == 'SPAMCOUNT' && $record->Spamcount > 0) {
                    $returnSet->push($record);
                } elseif (isset($params['Comment']) && $params['Comment'] == 'HIDDENCOUNT' && $record->Hiddencount > 0) {
                    $returnSet->push($record);
                } elseif ((isset($params['Comment']) && $params['Comment'] == '') || !isset($params['Comment'])) {
                    $returnSet->push($record);
                }
            }
        }

        return $returnSet;
    }
167645
private static function fetchByConditions( $conditions, $limit, $offset )
    {
        $db = eZDB::instance();

        $defaultConditions = array(
            'ezcobj_state.group_id=ezcobj_state_group.id',
            'ezcobj_state_language.contentobject_state_id=ezcobj_state.id',
            eZContentLanguage::languagesSQLFilter( 'ezcobj_state' ),
            eZContentLanguage::sqlFilter( 'ezcobj_state_language', 'ezcobj_state' )
        );

        $conditions = array_merge( $conditions, $defaultConditions );

        $conditionsSQL = implode( ' AND ', $conditions );

        $sql = "SELECT ezcobj_state.*, ezcobj_state_language.* " .
               "FROM ezcobj_state, ezcobj_state_group, ezcobj_state_language " .
               "WHERE $conditionsSQL " .
               "ORDER BY ezcobj_state.priority";

        $rows = $db->arrayQuery( $sql, array( 'limit' => $limit, 'offset' => $offset ) );

        $states = array();
        foreach ( $rows as $row )
        {
            $state = new eZContentObjectState( $row );
            $stateLanguage = new eZContentObjectStateLanguage( $row );
            $state->setLanguageObject( $stateLanguage );
            $states[] = $state;
        }

        return $states;
    }
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);
    }
962674
protected function getListLogOrder(array $limit)
    {
        $conditions = array(
            'limit' => $limit,
            'order_id' => $this->data_order['order_id']
        );

        return (array) $this->order_history->getList($conditions);
    }
372021
public static function filter(array $conditions)
    {

        $model = static::class;
        $obj = new $model();

        foreach ($conditions as $key => $condition) {

            if (is_array($condition)) {
                if (count($condition) == 1) {
                    $obj = $obj->where($key, $condition[0]);
                } elseif (count($condition) == 2) {
                    if (strtolower(trim($condition[0])) === 'between') {
                        $obj = $obj->whereBetween($key, $condition[1]);
                    } else {
                        $obj = $obj->where($key, $condition[0], $condition[1]);
                    }
                } elseif (count($condition) == 3) {
                    if (strtolower(trim($condition[0])) === 'between') {
                        $obj = $obj->whereBetween($key, $condition[1], $condition[2]);
                    } else {
                        $obj = $obj->where($key, $condition[0], $condition[1], $condition[2]);
                    }
                } else {
                    throw new \Exception("Invalid " . strtoupper($key) . " condition", 1);
                }
            } else {
                if (is_numeric($condition) || is_bool($condition)) {
                    $obj = $obj->where($key, $condition);
                } elseif (is_string($condition)) {
                    $obj = $obj->where($key, 'LIKE', $condition);
                } elseif (is_null($condition)) {
                    $obj = $obj->whereNull($key);
                } else {
                    throw new \Exception("Invalid " . strtoupper($key) . " condition", 2);
                }
            }
        }

        return $obj;
    }
3007
public static function load_db_logs(
			$filters = false,
			$limit = 200,
			$offset = 0,
			$order = false
		) {
			global $wpdb;

			$query = self::build_db_logs_query(
				$filters,
				$limit,
				$offset,
				$order
			);

			return $wpdb->get_results( $query );
		}
386239
public function filter(array $filters)
	{
		foreach ($filters as $filter) {
			if ($filter->isValueSet()) {
				if ($filter->hasConditionCallback()) {
					$data = (array) call_user_func_array(
						$filter->getConditionCallback(),
						[$this->data, $filter->getValue()]
					);
					$this->setData($data);
				} else {
					$data = array_filter($this->data, function ($row) use ($filter) {
						return $this->applyFilter($row, $filter);
					});
					$this->setData($data);
				}
			}
		}

		return $this;
	}