Skip to content

Commit

Permalink
refactor: add PageableRecollection (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi authored Jul 3, 2024
1 parent 2942f8b commit 56d1768
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* refactor: cleanup count traits
* refactor: refactor counting, change default strategy to
`ConditionalDelegatedCountStrategy`
* refactor: add `PageableRecollection`

## 0.6.2

Expand Down
26 changes: 26 additions & 0 deletions packages/collections-contracts/src/PageableRecollection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

/*
* This file is part of rekalogika/collections package.
*
* (c) Priyadi Iman Nurcahyo <https://rekalogika.dev>
*
* 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<TKey,T>
*/
interface PageableRecollection extends PageableInterface, \Countable
{
public function refreshCount(): void;
}
5 changes: 3 additions & 2 deletions packages/collections-domain/src/CriteriaPageable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,9 +28,9 @@
/**
* @template TKey of array-key
* @template T
* @implements PageableInterface<TKey,T>
* @implements PageableRecollection<TKey,T>
*/
class CriteriaPageable implements PageableInterface, \Countable
class CriteriaPageable implements PageableRecollection
{
/** @use RecollectionPageableTrait<TKey,T> */
use RecollectionPageableTrait;
Expand Down
5 changes: 3 additions & 2 deletions packages/collections-orm/src/QueryPageable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,9 +24,9 @@
/**
* @template TKey of array-key
* @template T
* @implements PageableInterface<TKey,T>
* @implements PageableRecollection<TKey,T>
*/
class QueryPageable implements PageableInterface, \Countable
class QueryPageable implements PageableRecollection
{
/** @use QueryBuilderPageableTrait<TKey,T> */
use QueryBuilderPageableTrait;
Expand Down

0 comments on commit 56d1768

Please sign in to comment.