Skip to content

Commit

Permalink
refactor: CriteriaPageable, CriteriaRecollection, `MinimalCriteri…
Browse files Browse the repository at this point in the history
…aRecollection` now respect default order by (#112)
  • Loading branch information
priyadi authored Jul 8, 2024
1 parent 8effcee commit 95a9311
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* refactor: consolidate util classes
* feat: default indexBy
* feat: repositories now automatically detect indexBy
* refactor: `CriteriaPageable`, `CriteriaRecollection`, `MinimalCriteriaRecollection`
now respect default order by

## 0.8.0

Expand Down
3 changes: 1 addition & 2 deletions packages/collections-domain/src/CriteriaPageable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace Rekalogika\Domain\Collections;

use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Order;
use Doctrine\Common\Collections\ReadableCollection;
use Doctrine\Common\Collections\Selectable;
use Rekalogika\Contracts\Collections\Exception\UnexpectedValueException;
Expand Down Expand Up @@ -81,7 +80,7 @@ final private function __construct(
$criteria = clone ($criteria ?? Criteria::create());

if (\count($criteria->orderings()) === 0) {
$criteria->orderBy(['id' => Order::Descending]);
$criteria->orderBy(Configuration::$defaultOrderBy);
}

$this->criteria = $criteria;
Expand Down
2 changes: 1 addition & 1 deletion packages/collections-domain/src/CriteriaRecollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ final private function __construct(
$criteria = clone ($criteria ?? Criteria::create());

if (\count($criteria->orderings()) === 0) {
$criteria->orderBy(['id' => Order::Descending]);
$criteria->orderBy(Configuration::$defaultOrderBy);
}

$this->criteria = $criteria;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace Rekalogika\Domain\Collections;

use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Order;
use Doctrine\Common\Collections\ReadableCollection;
use Doctrine\Common\Collections\Selectable;
use Rekalogika\Contracts\Collections\Exception\UnexpectedValueException;
Expand Down Expand Up @@ -82,7 +81,7 @@ final private function __construct(
$criteria = clone ($criteria ?? Criteria::create());

if (\count($criteria->orderings()) === 0) {
$criteria->orderBy(['id' => Order::Descending]);
$criteria->orderBy(Configuration::$defaultOrderBy);
}

$this->criteria = $criteria;
Expand Down

0 comments on commit 95a9311

Please sign in to comment.