1 | <?php |
||
19 | class RelationshipHandler implements HandlerInterface |
||
20 | { |
||
21 | /** |
||
22 | * Links' handler |
||
23 | * |
||
24 | * @var LinkHandlerInterface |
||
25 | */ |
||
26 | protected $linkHandler; |
||
27 | |||
28 | /** |
||
29 | * RelationshipHandler constructor. |
||
30 | * |
||
31 | * @param LinkHandlerInterface $linkHandler |
||
32 | */ |
||
33 | 2 | public function __construct(LinkHandlerInterface $linkHandler) |
|
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | 2 | public function toResource($object, ResourceObject $resource, MappingContext $context) |
|
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | public function fromResource($object, ResourceObject $resource, MappingContext $context) |
||
62 | |||
63 | /** |
||
64 | * Create relationship contains a single resource-identifier |
||
65 | * |
||
66 | * @param mixed $object |
||
67 | * @param RelationshipDefinition $definition |
||
68 | * @return SingleIdentifierRelationship |
||
69 | */ |
||
70 | 1 | protected function createSingleIdentifierRelationship($object, RelationshipDefinition $definition, MappingContext $context): SingleIdentifierRelationship |
|
84 | |||
85 | /** |
||
86 | * Create relationship contains a collection of resource-identifiers |
||
87 | * |
||
88 | * @param mixed $object |
||
89 | * @param RelationshipDefinition $definition |
||
90 | * @return IdentifierCollectionRelationship |
||
91 | */ |
||
92 | 1 | protected function createIdentifierCollectionRelationship($object, RelationshipDefinition $definition, MappingContext $context): IdentifierCollectionRelationship |
|
110 | |||
111 | /** |
||
112 | * Resolve ID of resource |
||
113 | * |
||
114 | * @param mixed $object |
||
115 | * @param RelationshipDefinition $definition |
||
116 | * @param MappingContext $context |
||
117 | * @return string |
||
118 | */ |
||
119 | 2 | protected function resolveIdentifier($object, RelationshipDefinition $definition, MappingContext $context): string |
|
129 | |||
130 | /** |
||
131 | * Resolve type of resource |
||
132 | * |
||
133 | * @param mixed $object |
||
134 | * @param RelationshipDefinition $definition |
||
135 | * @param MappingContext $context |
||
136 | * @return string |
||
137 | */ |
||
138 | 2 | protected function resolveType($object, RelationshipDefinition $definition, MappingContext $context): string |
|
146 | } |