38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\ReadModel;
|
||
|
|
|
||
|
|
use Doctrine\ORM\EntityManagerInterface;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Auto-generated query service for the TodoSummary read-model.
|
||
|
|
*
|
||
|
|
* Read-models are server-side projections — joined fetches, aggregates,
|
||
|
|
* denormalised views — that QML reads without going through a writable
|
||
|
|
* `#[BridgeResource]`. Replace the body of `query()` with the actual
|
||
|
|
* DQL / raw SQL / joined fetch.
|
||
|
|
*
|
||
|
|
* Per PLAN.md §4 *Pagination*, return an array of associative arrays so
|
||
|
|
* the controller can normalise to JSON without a serializer; or wire up
|
||
|
|
* a normalizer if you prefer typed DTOs in the projection.
|
||
|
|
*/
|
||
|
|
final readonly class TodoSummaryReadModel
|
||
|
|
{
|
||
|
|
public function __construct(
|
||
|
|
private EntityManagerInterface $em,
|
||
|
|
) {
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return list<array<string, mixed>>
|
||
|
|
*/
|
||
|
|
public function query(): array
|
||
|
|
{
|
||
|
|
// TODO: implement the read query — DQL, ->createQueryBuilder(),
|
||
|
|
// or ->getConnection()->executeQuery() as fits.
|
||
|
|
return [];
|
||
|
|
}
|
||
|
|
}
|