@@ 16-41 (lines=26) @@ | ||
13 | * |
|
14 | * @package Mikemirten\Component\JsonApi\Document |
|
15 | */ |
|
16 | class IdentifierCollectionDocument extends AbstractDocument implements IdentifierCollectionAwareInterface |
|
17 | { |
|
18 | use IdentifierCollectionContainer; |
|
19 | ||
20 | /** |
|
21 | * IdentifierCollectionDocument constructor. |
|
22 | * |
|
23 | * @param array $metadata |
|
24 | */ |
|
25 | public function __construct(array $metadata = []) |
|
26 | { |
|
27 | $this->metadata = $metadata; |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * {@inheritdoc} |
|
32 | */ |
|
33 | public function toArray(): array |
|
34 | { |
|
35 | $data = parent::toArray(); |
|
36 | ||
37 | $data['data'] = $this->identifiersToArray(); |
|
38 | ||
39 | return $data; |
|
40 | } |
|
41 | } |
@@ 16-41 (lines=26) @@ | ||
13 | * |
|
14 | * @package Mikemirten\Component\JsonApi\Document |
|
15 | */ |
|
16 | class IdentifierCollectionRelationship extends AbstractRelationship implements IdentifierCollectionAwareInterface |
|
17 | { |
|
18 | use IdentifierCollectionContainer; |
|
19 | ||
20 | /** |
|
21 | * IdentifierCollectionRelationship constructor. |
|
22 | * |
|
23 | * @param array $metadata |
|
24 | */ |
|
25 | public function __construct(array $metadata = []) |
|
26 | { |
|
27 | $this->metadata = $metadata; |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * {@inheritdoc} |
|
32 | */ |
|
33 | public function toArray(): array |
|
34 | { |
|
35 | $data = parent::toArray(); |
|
36 | ||
37 | $data['data'] = $this->identifiersToArray(); |
|
38 | ||
39 | return $data; |
|
40 | } |
|
41 | } |