| @@ 64-77 (lines=14) @@ | ||
| 61 | * @param array $json |
|
| 62 | * @return array |
|
| 63 | */ |
|
| 64 | protected function hydrateNestedResources(ResourceInterface $object, array $json) |
|
| 65 | { |
|
| 66 | $annotation = $this->getAnnotation($object); |
|
| 67 | ||
| 68 | if (!($annotation instanceof Nested)) { |
|
| 69 | return $json; |
|
| 70 | } |
|
| 71 | ||
| 72 | foreach ($annotation->properties() as $property) { |
|
| 73 | $json[$property] = $this->hydrate($annotation->get($property), $json[$property]); |
|
| 74 | } |
|
| 75 | ||
| 76 | return $json; |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * @param string $class |
|
| @@ 107-120 (lines=14) @@ | ||
| 104 | * @param ResourceInterface $object |
|
| 105 | * @return array |
|
| 106 | */ |
|
| 107 | protected function extractNestedResources(array $json, ResourceInterface $object) |
|
| 108 | { |
|
| 109 | $annotation = $this->getAnnotation($object); |
|
| 110 | ||
| 111 | if (!($annotation instanceof Nested)) { |
|
| 112 | return $json; |
|
| 113 | } |
|
| 114 | ||
| 115 | foreach ($annotation->properties() as $property) { |
|
| 116 | $json[$property] = $this->extract($annotation->get($property), $json[$property]); |
|
| 117 | } |
|
| 118 | ||
| 119 | return $json; |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * @param ResourceInterface $object |
|