@@ 23-39 (lines=17) @@ | ||
20 | /** |
|
21 | * {@inheritdoc} |
|
22 | */ |
|
23 | public function hydrate($object, $source, DocumentHydrator $hydrator) |
|
24 | { |
|
25 | if (! $object instanceof LinksAwareInterface) { |
|
26 | throw new InvalidDocumentException(sprintf( |
|
27 | 'Given instance of "%s" does not implements "%s"', |
|
28 | get_class($object), |
|
29 | LinksAwareInterface::class |
|
30 | )); |
|
31 | } |
|
32 | ||
33 | foreach ($source as $name => $content) |
|
34 | { |
|
35 | $link = $this->createLink($content, $hydrator); |
|
36 | ||
37 | $object->setLink($name, $link); |
|
38 | } |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * Create link |
@@ 25-41 (lines=17) @@ | ||
22 | /** |
|
23 | * {@inheritdoc} |
|
24 | */ |
|
25 | public function hydrate($object, $source, DocumentHydrator $hydrator) |
|
26 | { |
|
27 | if (! $object instanceof RelationshipsAwareInterface) { |
|
28 | throw new InvalidDocumentException(sprintf( |
|
29 | 'Given instance of "%s" does not implements "%s"', |
|
30 | get_class($object), |
|
31 | RelationshipsAwareInterface::class |
|
32 | )); |
|
33 | } |
|
34 | ||
35 | foreach ($source as $name => $content) |
|
36 | { |
|
37 | $relationship = $this->createRelationship($content, $hydrator); |
|
38 | ||
39 | $object->setRelationship($name, $relationship); |
|
40 | } |
|
41 | } |
|
42 | ||
43 | /** |
|
44 | * Create relationship |