| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace LaravelUi5\OData\Service\Contracts; |
| 6: | |
| 7: | use LaravelUi5\OData\Edm\Contracts\Type\EntityTypeInterface; |
| 8: | |
| 9: | /** |
| 10: | * Self-describing entity set resolver. |
| 11: | * |
| 12: | * Implementations colocate the entity type definition with the query logic, |
| 13: | * keeping everything in one class. Use this for entity sets that don't map |
| 14: | * to a single Eloquent model or SQL table — e.g., aggregated views, |
| 15: | * cross-model projections, or external API-backed data. |
| 16: | * |
| 17: | * Register via ODataService::discoverCustomEntitySet(): |
| 18: | * |
| 19: | * $this->discoverCustomEntitySet(BillableProjectsResolver::class); |
| 20: | * |
| 21: | * This single call adds the entity type and set to the Edm, and registers |
| 22: | * the CustomBinding in the resolver map — no manual configure() or |
| 23: | * registerBindings() wiring needed. |
| 24: | */ |
| 25: | interface CustomEntitySetInterface extends EntitySetResolverInterface |
| 26: | { |
| 27: | /** |
| 28: | * The entity set name as it appears in the OData service document. |
| 29: | */ |
| 30: | public function entitySetName(): string; |
| 31: | |
| 32: | /** |
| 33: | * The entity type definition for this entity set. |
| 34: | * |
| 35: | * @param string $namespace The service namespace (e.g. 'io.pragmatiqu') |
| 36: | */ |
| 37: | public function entityType(string $namespace): EntityTypeInterface; |
| 38: | } |
| 39: |