1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace LaravelUi5\OData\Service\Contracts;
6:
7: /**
8: * Resolves an entity-set query plan into a lazy stream of entities.
9: *
10: * Implementations live in Driver\ and translate the plan into database queries.
11: * The plan parameter is typed as QueryPlanInterface to keep Service\ free of
12: * Protocol\ imports; at runtime the value is always an EntitySetQueryPlan.
13: *
14: * @see QueryPlanInterface
15: */
16: interface EntitySetResolverInterface
17: {
18: /**
19: * Execute the plan and yield entity data one record at a time.
20: *
21: * The generator yields raw associative arrays or value objects — the exact
22: * shape is defined by the driver. Protocol\Serialization\ consumes the
23: * generator and writes directly to the output stream.
24: *
25: * @param QueryPlanInterface $plan At runtime always Protocol\Planning\EntitySetQueryPlan
26: * @return \Generator<mixed>
27: */
28: public function resolve(QueryPlanInterface $plan): \Generator;
29:
30: /**
31: * Return the total number of entities matching the plan's filter,
32: * ignoring $top/$skip pagination.
33: *
34: * Called by the engine when $count=true is present on the request.
35: *
36: * @param QueryPlanInterface $plan At runtime always Protocol\Planning\EntitySetQueryPlan
37: */
38: public function count(QueryPlanInterface $plan): int;
39: }
40: