diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f30ab3..e5bc79f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * refactor: cleanup count traits * refactor: refactor counting, change default strategy to `ConditionalDelegatedCountStrategy` +* refactor: add `PageableRecollection` ## 0.6.2 diff --git a/packages/collections-contracts/src/PageableRecollection.php b/packages/collections-contracts/src/PageableRecollection.php new file mode 100644 index 0000000..e25a032 --- /dev/null +++ b/packages/collections-contracts/src/PageableRecollection.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE file + * that was distributed with this source code. + */ + +namespace Rekalogika\Contracts\Collections; + +use Rekalogika\Contracts\Rekapager\PageableInterface; + +/** + * @template TKey of array-key + * @template-covariant T + * @extends PageableInterface + */ +interface PageableRecollection extends PageableInterface, \Countable +{ + public function refreshCount(): void; +} diff --git a/packages/collections-domain/src/CriteriaPageable.php b/packages/collections-domain/src/CriteriaPageable.php index bcc23eb..adb5c0b 100644 --- a/packages/collections-domain/src/CriteriaPageable.php +++ b/packages/collections-domain/src/CriteriaPageable.php @@ -18,6 +18,7 @@ use Doctrine\Common\Collections\ReadableCollection; use Doctrine\Common\Collections\Selectable; use Rekalogika\Contracts\Collections\Exception\UnexpectedValueException; +use Rekalogika\Contracts\Collections\PageableRecollection; use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Domain\Collections\Common\Count\CountStrategy; use Rekalogika\Domain\Collections\Common\Trait\CountableTrait; @@ -27,9 +28,9 @@ /** * @template TKey of array-key * @template T - * @implements PageableInterface + * @implements PageableRecollection */ -class CriteriaPageable implements PageableInterface, \Countable +class CriteriaPageable implements PageableRecollection { /** @use RecollectionPageableTrait */ use RecollectionPageableTrait; diff --git a/packages/collections-orm/src/QueryPageable.php b/packages/collections-orm/src/QueryPageable.php index e4b6fcc..dde475c 100644 --- a/packages/collections-orm/src/QueryPageable.php +++ b/packages/collections-orm/src/QueryPageable.php @@ -15,6 +15,7 @@ use Doctrine\ORM\QueryBuilder; use Rekalogika\Collections\ORM\Trait\QueryBuilderPageableTrait; +use Rekalogika\Contracts\Collections\PageableRecollection; use Rekalogika\Contracts\Rekapager\PageableInterface; use Rekalogika\Domain\Collections\Common\Count\CountStrategy; use Rekalogika\Domain\Collections\Common\Trait\CountableTrait; @@ -23,9 +24,9 @@ /** * @template TKey of array-key * @template T - * @implements PageableInterface + * @implements PageableRecollection */ -class QueryPageable implements PageableInterface, \Countable +class QueryPageable implements PageableRecollection { /** @use QueryBuilderPageableTrait */ use QueryBuilderPageableTrait;