futtern/src/State/LatestOrderProvider.php
Jan Felix Wiebe 300c8cafc9
Some checks failed
/ ls (pull_request) Successful in 2m6s
/ ls (release) Successful in 1m18s
/ ls (push) Failing after 1m25s
added a /api/food_orders/latest/ endpoint to recieve the latest food order
2025-06-17 21:26:05 +02:00

22 lines
No EOL
567 B
PHP

<?php declare(strict_types=1);
namespace App\State;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
use App\Entity\FoodOrder;
use App\Repository\FoodOrderRepository;
use Override;
final readonly class LatestOrderProvider implements ProviderInterface
{
public function __construct(
private FoodOrderRepository $repository
) {}
#[Override]
public function provide(Operation $operation, array $uriVariables = [], array $context = []): ?FoodOrder
{
return $this->repository->findLatestOrder();
}
}