| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace LaravelUi5\OData\Edm\Contracts\Type; |
| 6: | |
| 7: | use LaravelUi5\OData\Edm\Contracts\AnnotationTargetInterface; |
| 8: | use LaravelUi5\OData\Edm\Contracts\Property\NavigationPropertyInterface; |
| 9: | use LaravelUi5\OData\Edm\Contracts\Property\PropertyInterface; |
| 10: | |
| 11: | /** |
| 12: | * An entity type, the central construct of the OData Edm. |
| 13: | * |
| 14: | * Entity types represent things with identity — rows in a table, |
| 15: | * documents in a collection. They carry a key (one or more |
| 16: | * structural properties that uniquely identify an instance), |
| 17: | * structural properties, and navigation properties that associate |
| 18: | * them with other entity types. |
| 19: | * |
| 20: | * @see OData CSDL XML v4.01 §6 (Entity Type) |
| 21: | */ |
| 22: | interface EntityTypeInterface extends StructuredTypeInterface, AnnotationTargetInterface |
| 23: | { |
| 24: | /** |
| 25: | * The base entity type this type derives from, or null for |
| 26: | * a root type. |
| 27: | * |
| 28: | * @see OData CSDL XML v4.01 §6.1 |
| 29: | */ |
| 30: | public function getBaseType(): ?EntityTypeInterface; |
| 31: | |
| 32: | /** |
| 33: | * The properties that form the key of this entity type. |
| 34: | * |
| 35: | * For derived types the key is inherited from the root type; |
| 36: | * this method returns that inherited key rather than an empty |
| 37: | * collection. Returns an empty array only for abstract base |
| 38: | * types that defer key declaration to their subtypes. |
| 39: | * |
| 40: | * The order of properties in the returned list is significant |
| 41: | * and matches the CSDL declaration order. |
| 42: | * |
| 43: | * @return list<PropertyInterface> |
| 44: | * @see OData CSDL XML v4.01 §6.5 |
| 45: | */ |
| 46: | public function getKey(): array; |
| 47: | |
| 48: | /** |
| 49: | * All navigation properties declared directly on this type, |
| 50: | * not including navigation properties inherited from a base type. |
| 51: | * |
| 52: | * @return list<NavigationPropertyInterface> |
| 53: | */ |
| 54: | public function getDeclaredNavigationProperties(): array; |
| 55: | |
| 56: | /** |
| 57: | * Returns a navigation property by name, searching this type |
| 58: | * and all base types in the inheritance chain. |
| 59: | * |
| 60: | * Returns null when no navigation property with that name |
| 61: | * exists anywhere in the hierarchy. |
| 62: | */ |
| 63: | public function getNavigationProperty(string $name): ?NavigationPropertyInterface; |
| 64: | |
| 65: | /** |
| 66: | * Whether this entity type is a media entity — i.e. it |
| 67: | * represents a stream of binary data with associated metadata. |
| 68: | * |
| 69: | * @see OData CSDL XML v4.01 §6.4 |
| 70: | */ |
| 71: | public function hasStream(): bool; |
| 72: | } |
| 73: |