add open orders api route
This commit is contained in:
parent
5de80b0da0
commit
96b246462a
5 changed files with 79 additions and 0 deletions
|
@ -47,4 +47,19 @@ final class FoodOrderRepository extends ServiceEntityRepository
|
|||
->filter(static fn(FoodOrder $order): bool => $order->getCreatedAt() >= $date)
|
||||
->getValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FoodOrder[]
|
||||
*/
|
||||
public function findOpenOrders(): array
|
||||
{
|
||||
$now = new DateTimeImmutable;
|
||||
|
||||
return $this->createQueryBuilder('o')
|
||||
->where('o.closedAt IS NULL OR o.closedAt > :now')
|
||||
->setParameter('now', $now)
|
||||
->orderBy('o.id', 'DESC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue