mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Force type-hint and handle null value in ordering
This commit is contained in:
parent
dd21694544
commit
ae04172929
@ -73,18 +73,16 @@ final class ResultRepository implements ObjectRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed|null $orderBy
|
* @return array<Result>
|
||||||
* @param mixed|null $limit
|
|
||||||
* @param mixed|null $offset
|
|
||||||
*
|
|
||||||
* @return Result[]
|
|
||||||
*/
|
*/
|
||||||
public function findByGoal(Goal $goal, $orderBy = null, $limit = null, $offset = null): array
|
public function findByGoal(Goal $goal, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
||||||
{
|
{
|
||||||
$qb = $this->buildQueryByGoal($goal);
|
$qb = $this->buildQueryByGoal($goal);
|
||||||
|
|
||||||
foreach ($orderBy as $sort => $order) {
|
if (null !== $orderBy) {
|
||||||
$qb->addOrderBy('r.' . $sort, $order);
|
foreach ($orderBy as $sort => $order) {
|
||||||
|
$qb->addOrderBy('r.' . $sort, $order);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $qb
|
return $qb
|
||||||
|
Loading…
x
Reference in New Issue
Block a user