| @@ 71-84 (lines=14) @@ | ||
| 68 | * @param array $json | |
| 69 | * @return array | |
| 70 | */ | |
| 71 | protected function hydrateNestedResources(ResourceInterface $object, array $json) | |
| 72 |     { | |
| 73 | $annotation = $this->getAnnotation($object, Nested::class); | |
| 74 | ||
| 75 |         if (!($annotation instanceof Nested)) { | |
| 76 | return $json; | |
| 77 | } | |
| 78 | ||
| 79 |         foreach ($annotation->properties() as $property) { | |
| 80 | $json[$property] = $this->hydrate($annotation->get($property), $json[$property]); | |
| 81 | } | |
| 82 | ||
| 83 | return $json; | |
| 84 | } | |
| 85 | ||
| 86 | /** | |
| 87 | * @param ResourceInterface $object | |
| @@ 140-153 (lines=14) @@ | ||
| 137 | * @param ResourceInterface $object | |
| 138 | * @return array | |
| 139 | */ | |
| 140 | protected function extractNestedResources(array $json, ResourceInterface $object) | |
| 141 |     { | |
| 142 | $annotation = $this->getAnnotation($object, Nested::class); | |
| 143 | ||
| 144 |         if (!($annotation instanceof Nested)) { | |
| 145 | return $json; | |
| 146 | } | |
| 147 | ||
| 148 |         foreach ($annotation->properties() as $property) { | |
| 149 | $json[$property] = $this->extract($annotation->get($property), $json[$property]); | |
| 150 | } | |
| 151 | ||
| 152 | return $json; | |
| 153 | } | |
| 154 | ||
| 155 | /** | |
| 156 | * @param array $json | |