1 | <?php |
||
21 | class RelationshipHandler implements HandlerInterface |
||
22 | { |
||
23 | /** |
||
24 | * Links' handler |
||
25 | * |
||
26 | * @var LinkHandlerInterface |
||
27 | */ |
||
28 | protected $linkHandler; |
||
29 | |||
30 | /** |
||
31 | * RelationshipHandler constructor. |
||
32 | * |
||
33 | * @param LinkHandlerInterface $linkHandler |
||
34 | */ |
||
35 | 5 | public function __construct(LinkHandlerInterface $linkHandler) |
|
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | 5 | public function toResource($object, ResourceObject $resource, MappingContext $context) |
|
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function fromResource($object, ResourceObject $resource, MappingContext $context) |
||
63 | |||
64 | /** |
||
65 | * Create relationship contains a single resource-identifier |
||
66 | * |
||
67 | * @param mixed $object |
||
68 | * @param RelationshipDefinition $definition |
||
69 | * @param MappingContext $context |
||
70 | * @return AbstractRelationship |
||
71 | */ |
||
72 | 5 | protected function createRelationship($object, RelationshipDefinition $definition, MappingContext $context): AbstractRelationship |
|
82 | |||
83 | /** |
||
84 | * Create relationship contains a single resource-identifier |
||
85 | * |
||
86 | * @param mixed $object |
||
87 | * @param RelationshipDefinition $definition |
||
88 | * @param MappingContext $context |
||
89 | * @return AbstractRelationship ( NoDataRelationship | NoDataRelationship ) |
||
90 | */ |
||
91 | 1 | protected function createSingleIdentifierRelationship($object, RelationshipDefinition $definition, MappingContext $context): AbstractRelationship |
|
103 | |||
104 | /** |
||
105 | * Create relationship contains a collection of resource-identifiers |
||
106 | * |
||
107 | * @param mixed $object |
||
108 | * @param RelationshipDefinition $definition |
||
109 | * @param MappingContext $context |
||
110 | * @return IdentifierCollectionRelationship |
||
111 | */ |
||
112 | 2 | protected function createIdentifierCollectionRelationship($object, RelationshipDefinition $definition, MappingContext $context): IdentifierCollectionRelationship |
|
133 | } |