1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace LaravelUi5\OData\Edm\Contracts\Property;
6:
7: use LaravelUi5\OData\Edm\Contracts\AnnotatableInterface;
8: use LaravelUi5\OData\Edm\Contracts\AnnotationTargetInterface;
9: use LaravelUi5\OData\Edm\Contracts\NamedElementInterface;
10: use LaravelUi5\OData\Edm\Contracts\Type\EntityTypeInterface;
11:
12: /**
13: * A navigation property, representing an association between two
14: * entity types.
15: *
16: * Unlike structural properties, navigation properties always point
17: * to an EntityType. They may be single-valued or collection-valued,
18: * may declare a partner on the target side, and may declare
19: * referential constraints that tie foreign-key structural properties
20: * to the principal key.
21: *
22: * @see OData CSDL XML v4.01 §8 (Navigation Property)
23: */
24: interface NavigationPropertyInterface extends NamedElementInterface, AnnotatableInterface, AnnotationTargetInterface
25: {
26: /**
27: * The resolved target entity type of this navigation property.
28: *
29: * @see OData CSDL XML v4.01 §8.1
30: */
31: public function getTargetType(): EntityTypeInterface;
32:
33: /**
34: * Whether this navigation property is collection-valued.
35: *
36: * @see OData CSDL XML v4.01 §8.1
37: */
38: public function isCollection(): bool;
39:
40: /**
41: * Whether a null target is permitted for a single-valued
42: * navigation property. Always false for collection-valued
43: * navigation properties.
44: *
45: * @see OData CSDL XML v4.01 §8.2
46: */
47: public function isNullable(): bool;
48:
49: /**
50: * The name of the partner navigation property on the target
51: * entity type, or null when no partner is declared.
52: *
53: * The partner is not resolved to an object here because doing so
54: * would introduce a circular reference between the two types.
55: * Callers can resolve the name via the target type if needed.
56: *
57: * @see OData CSDL XML v4.01 §8.3
58: */
59: public function getPartnerName(): ?string;
60:
61: /**
62: * Whether this navigation property defines a containment
63: * relationship, meaning the target entities are part of the
64: * source entity and have no independent identity outside of it.
65: *
66: * @see OData CSDL XML v4.01 §8.4
67: */
68: public function isContainmentTarget(): bool;
69:
70: /**
71: * The referential constraints declared on this navigation property,
72: * mapping dependent structural property names to principal property
73: * names. Returns an empty array when none are declared.
74: *
75: * The array key is the name of the dependent property on this
76: * entity type; the value is the name of the referenced property
77: * on the principal entity type.
78: *
79: * @return array<string, string>
80: * @see OData CSDL XML v4.01 §8.5
81: */
82: public function getReferentialConstraints(): array;
83:
84: /**
85: * The on-delete action declared for this relationship, or null
86: * when absent. Possible values per spec: "Cascade", "None",
87: * "SetNull", "SetDefault".
88: *
89: * @see OData CSDL XML v4.01 §8.6
90: */
91: public function getOnDeleteAction(): ?string;
92: }
93: