protected function resolveNextSequenceIdForGivenLimit(int $lastSearchesLimit) : int
    {
        $nextSequenceId = 0;

        $queryBuilder = $this->getQueryBuilder();
        $result = $queryBuilder->select('sequence_id')
            ->from($this->table)
            ->orderBy('tstamp', 'DESC')
            ->setMaxResults(1)
            ->execute()->fetch();

        if (!empty($result)) {
            $nextSequenceId = ($result['sequence_id'] + 1) % $lastSearchesLimit;
        }

        return $nextSequenceId;
    }
protected function resolveNextSequenceIdForGivenLimit(int $lastSearchesLimit) : int
    {
        $nextSequenceId = 0;

        $queryBuilder = $this->getQueryBuilder();
        $result = $queryBuilder->select('sequence_id')
            ->from($this->table)
            ->orderBy('tstamp', 'DESC')
            ->setMaxResults(1)
            ->execute()->fetch();

        if (!empty($result)) {
            $nextSequenceId = ($result['sequence_id'] + 1) % $lastSearchesLimit;
        }

        return $nextSequenceId;
    }
protected function resolveNextSequenceIdForGivenLimit ( int $ lastSearchesLimit ) : int { $ nextSequenceId = 0 ; $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ result = $ queryBuilder -> select ( 'sequence_id' ) -> from ( $ this -> table ) -> orderBy ( 'tstamp' , 'DESC' ) -> setMaxResults ( 1 ) -> execute ( ) -> fetch ( ) ; if ( ! empty ( $ result ) ) { $ nextSequenceId = ( $ result [ 'sequence_id' ] + 1 ) % $ lastSearchesLimit ; } return $ nextSequenceId ; }
Resolves next sequence id by given last searches limit.

@param int $lastSearchesLimit
@return int
Resolves next sequence id by given last searches limit .