Files

29 lines
739 B
PHP
Raw Permalink Normal View History

2026-05-03 20:28:50 +02:00
<?php
declare(strict_types=1);
namespace App\Controller;
use App\ReadModel\TodoSummaryReadModel;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
/**
* Read-only endpoint for the TodoSummary projection.
* Auto-generated by `make:bridge:read-model` — the read-model owns
* the query; this controller just normalises the result to JSON.
*/
final class TodoSummaryController
{
public function __construct(
private readonly TodoSummaryReadModel $readModel,
) {
}
#[Route('/api/todo-summaries', name: 'todo_summary_read', methods: ['GET'])]
public function __invoke(): JsonResponse
{
return new JsonResponse($this->readModel->query());
}
}