@@ 69-82 (lines=14) @@ | ||
66 | * @param array $json |
|
67 | * @return array |
|
68 | */ |
|
69 | protected function hydrateNestedResources(ResourceInterface $object, array $json) |
|
70 | { |
|
71 | $annotation = $this->getAnnotation($object); |
|
72 | ||
73 | if (!($annotation instanceof Nested)) { |
|
74 | return $json; |
|
75 | } |
|
76 | ||
77 | foreach ($annotation->properties() as $property) { |
|
78 | $json[$property] = $this->hydrate($annotation->get($property), $json[$property]); |
|
79 | } |
|
80 | ||
81 | return $json; |
|
82 | } |
|
83 | ||
84 | /** |
|
85 | * @param string $class |
|
@@ 112-125 (lines=14) @@ | ||
109 | * @param ResourceInterface $object |
|
110 | * @return array |
|
111 | */ |
|
112 | protected function extractNestedResources(array $json, ResourceInterface $object) |
|
113 | { |
|
114 | $annotation = $this->getAnnotation($object); |
|
115 | ||
116 | if (!($annotation instanceof Nested)) { |
|
117 | return $json; |
|
118 | } |
|
119 | ||
120 | foreach ($annotation->properties() as $property) { |
|
121 | $json[$property] = $this->extract($annotation->get($property), $json[$property]); |
|
122 | } |
|
123 | ||
124 | return $json; |
|
125 | } |
|
126 | ||
127 | /** |
|
128 | * @param ResourceInterface $object |