declare(strict_types=1); namespace App\Controller; use App\ReadModel\ReadModel; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Routing\Attribute\Route; /** * Read-only endpoint for the projection. * Auto-generated by `make:bridge:read-model` — the read-model owns * the query; this controller just normalises the result to JSON. */ final class Controller { public function __construct( private readonly ReadModel $readModel, ) { } #[Route('', name: '_read', methods: ['GET'])] public function __invoke(): JsonResponse { return new JsonResponse($this->readModel->query()); } }