added a /api/food_orders/latest/ endpoint to recieve the latest food order
This commit is contained in:
parent
ee32852789
commit
300c8cafc9
4 changed files with 64 additions and 0 deletions
|
@ -62,4 +62,16 @@ final class FoodOrderRepository extends ServiceEntityRepository
|
|||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FoodOrder|null
|
||||
*/
|
||||
public function findLatestOrder(): ?FoodOrder
|
||||
{
|
||||
return $this->createQueryBuilder('alias')
|
||||
->orderBy('alias.id', 'DESC')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue