| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace LaravelUi5\OData\Service\Contracts; |
| 6: | |
| 7: | /** |
| 8: | * Resolves a single-entity plan into one row, or null when not found. |
| 9: | * |
| 10: | * Intended to be implemented alongside EntitySetResolverInterface by the |
| 11: | * same driver class (e.g. EloquentEntitySetResolver). EntityHandler retrieves |
| 12: | * the resolver via RuntimeSchemaInterface::getResolver() and then checks |
| 13: | * instanceof EntityResolverInterface before calling resolveOne(). |
| 14: | * |
| 15: | * The plan parameter is typed as QueryPlanInterface to keep Service\ free of |
| 16: | * Protocol\ imports; at runtime the value is always Protocol\Planning\EntityQueryPlan. |
| 17: | * |
| 18: | * @see EntitySetResolverInterface |
| 19: | */ |
| 20: | interface EntityResolverInterface |
| 21: | { |
| 22: | /** |
| 23: | * Execute the plan and return the matching entity as an associative array, |
| 24: | * or null when no entity with the given key exists. |
| 25: | * |
| 26: | * @param QueryPlanInterface $plan At runtime always Protocol\Planning\EntityQueryPlan |
| 27: | * @return array<string, mixed>|null |
| 28: | */ |
| 29: | public function resolveOne(QueryPlanInterface $plan): ?array; |
| 30: | } |
| 31: |