Skip to content

Commit

Permalink
Fix #64: Fix yiisoft/data compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Sep 12, 2024
1 parent dbb523e commit d84c005
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/AbstractQueryDataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class AbstractQueryDataReader implements QueryDataReaderInterface
private ?Sort $sort = null;
private ?FilterInterface $filter = null;
private ?FilterInterface $having = null;
private int $limit = 0;
private ?int $limit = null;
private int $offset = 0;

/**
Expand Down Expand Up @@ -163,7 +163,7 @@ public function withOffset(int $offset): static
* @psalm-mutation-free
* @psalm-return static<TKey, TValue>
*/
public function withLimit(int $limit): static
public function withLimit(?int $limit): static
{
if ($limit < 0) {
throw new InvalidArgumentException('$limit must not be less than 0.');
Expand Down Expand Up @@ -210,7 +210,7 @@ public function withSort(?Sort $sort): static
* @psalm-mutation-free
* @psalm-return static<TKey, TValue>
*/
public function withFilter(FilterInterface $filter): static
public function withFilter(?FilterInterface $filter): static
{
$new = clone $this;
$new->filter = $filter;
Expand Down Expand Up @@ -313,4 +313,19 @@ public function readOne(): array|object|null
* @psalm-return TValue
*/
abstract protected function createItem(array|object $row): array|object;

public function getFilter(): ?FilterInterface
{
return $this->filter;
}

public function getLimit(): ?int
{
return $this->limit;
}

public function getOffset(): int
{
return $this->offset;
}
}
2 changes: 2 additions & 0 deletions src/QueryDataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Yiisoft\Data\Db;

use Yiisoft\Data\Reader\FilterInterface;

/**
* Base class for `QueryDataReaderInterface`
*
Expand Down

0 comments on commit d84c005

Please sign in to comment.