@@ -281,16 +281,9 @@ private function process($data, $import = true, DataPreProcessor $preProcessor =
281281 }
282282 }
283283
284- $ propertyMap = null ;
285284 if ($ this ->properties !== null ) {
286285 /** @var Schema[] $properties */
287286 $ properties = &$ this ->properties ->toArray (); // TODO check performance of pointer
288- if ($ import ) {
289- $ propertyMap = $ this ->properties ->getDataToPropertyMap (); // TODO check performance of pointer
290- } else {
291- $ propertyMap = $ this ->properties ->getPropertyToDataMap (); // TODO check performance of pointer
292- }
293-
294287 $ nestedProperties = $ this ->properties ->getNestedProperties ();
295288 }
296289
@@ -317,22 +310,20 @@ private function process($data, $import = true, DataPreProcessor $preProcessor =
317310 }
318311 }
319312
313+ $ propertyFound = false ;
320314 if (isset ($ properties [$ key ])) {
321- if (null !== $ propertyMap ) {
322-
323-
324- }
325-
315+ $ propertyFound = true ;
326316 $ found = true ;
327317 $ value = $ properties [$ key ]->process ($ value , $ import , $ preProcessor , $ path . '->properties: ' . $ key );
328318 }
329319
330- /** @var Egg $nestedEgg */
331- $ nestedEgg = null ;
332- if (! $ found && isset ($ nestedProperties [$ key ])) {
320+ /** @var Egg[] $nestedEggs */
321+ $ nestedEggs = null ;
322+ if (isset ($ nestedProperties [$ key ])) {
333323 $ found = true ;
334- $ nestedEgg = $ nestedProperties [$ key ];
335- $ value = $ nestedEgg ->propertySchema ->process ($ value , $ import , $ preProcessor , $ path . '->nestedProperties: ' . $ key );
324+ $ nestedEggs = $ nestedProperties [$ key ];
325+ // todo iterate all nested props?
326+ $ value = $ nestedEggs [0 ]->propertySchema ->process ($ value , $ import , $ preProcessor , $ path . '->nestedProperties: ' . $ key );
336327 }
337328
338329 if ($ this ->patternProperties !== null ) {
@@ -358,8 +349,13 @@ private function process($data, $import = true, DataPreProcessor $preProcessor =
358349 }
359350 }
360351
361- if ($ nestedEgg && $ import ) {
362- $ result ->setNestedProperty ($ key , $ value , $ nestedEgg );
352+ if ($ nestedEggs && $ import ) {
353+ foreach ($ nestedEggs as $ nestedEgg ) {
354+ $ result ->setNestedProperty ($ key , $ value , $ nestedEgg );
355+ }
356+ if ($ propertyFound ) {
357+ $ result ->$ key = $ value ;
358+ }
363359 } else {
364360 $ result ->$ key = $ value ;
365361 }
0 commit comments