1 | <?php |
||
18 | class RelationshipHandler implements HandlerInterface |
||
19 | { |
||
20 | /** |
||
21 | * {@inheritdoc} |
||
22 | */ |
||
23 | 2 | public function toResource($object, ResourceObject $resource, MappingContext $context) |
|
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | public function fromResource($object, ResourceObject $resource, MappingContext $context) |
||
44 | |||
45 | /** |
||
46 | * Create relationship contains a single resource-identifier |
||
47 | * |
||
48 | * @param mixed $object |
||
49 | * @param RelationshipDefinition $definition |
||
50 | * @return SingleIdentifierRelationship |
||
51 | */ |
||
52 | 1 | protected function createSingleIdentifierRelationship($object, RelationshipDefinition $definition, MappingContext $context): SingleIdentifierRelationship |
|
63 | |||
64 | /** |
||
65 | * Create relationship contains a collection of resource-identifiers |
||
66 | * |
||
67 | * @param mixed $object |
||
68 | * @param RelationshipDefinition $definition |
||
69 | * @return IdentifierCollectionRelationship |
||
70 | */ |
||
71 | 1 | protected function createIdentifierCollectionRelationship($object, RelationshipDefinition $definition, MappingContext $context): IdentifierCollectionRelationship |
|
87 | |||
88 | /** |
||
89 | * Resolve ID of resource |
||
90 | * |
||
91 | * @param mixed $object |
||
92 | * @param RelationshipDefinition $definition |
||
93 | * @param MappingContext $context |
||
94 | * @return string |
||
95 | */ |
||
96 | 2 | protected function resolveIdentifier($object, RelationshipDefinition $definition, MappingContext $context): string |
|
106 | |||
107 | /** |
||
108 | * Resolve type of resource |
||
109 | * |
||
110 | * @param mixed $object |
||
111 | * @param RelationshipDefinition $definition |
||
112 | * @param MappingContext $context |
||
113 | * @return string |
||
114 | */ |
||
115 | 2 | protected function resolveType($object, RelationshipDefinition $definition, MappingContext $context): string |
|
123 | } |