@@ -290,10 +290,11 @@ private function convertCcmToTargetCms($ccmItems, $targetCms, $targetType) {
290290 $ targetItem = [];
291291 foreach ($ targetToCcm as $ targetKey => $ ccmMap ) {
292292 if (is_array ($ ccmMap )) {
293- $ ccmKey = $ ccmMap ['ccm ' ] ?? null ;
294- $ type = $ ccmMap ['type ' ] ?? null ;
295- $ format = $ ccmMap ['format ' ] ?? null ;
296- $ value = null ;
293+ $ ccmKey = $ ccmMap ['ccm ' ] ?? null ;
294+ $ type = $ ccmMap ['type ' ] ?? null ;
295+ $ format = $ ccmMap ['format ' ] ?? null ;
296+ $ entityType = $ ccmMap ['entityType ' ] ?? null ;
297+ $ value = null ;
297298
298299 if ($ ccmKey && isset ($ ccmItem [$ ccmKey ])) {
299300 $ value = $ ccmItem [$ ccmKey ];
@@ -450,21 +451,21 @@ private function convertCcmToTargetCms($ccmItems, $targetCms, $targetType) {
450451 foreach ($ value as $ arrayValue ) {
451452 if (is_numeric ($ arrayValue ) || (is_string ($ arrayValue ) && ctype_digit (trim ($ arrayValue )))) {
452453 $ numericValue = intval ($ arrayValue );
453- $ mappedValue = MigrationHelper::mapEntityId ($ numericValue , $ this ->migrationMap );
454+ $ mappedValue = MigrationHelper::mapEntityId ($ numericValue , $ this ->migrationMap , $ entityType );
454455 $ mappedValues [] = $ mappedValue ;
455456 }
456457 }
457458 $ value = $ mappedValues ;
458459 }
459460 } elseif (is_numeric ($ value ) || (is_string ($ value ) && ctype_digit (trim ($ value )))) {
460- $ mappedValue = MigrationHelper::mapEntityId (intval ($ value ), $ this ->migrationMap );
461+ $ mappedValue = MigrationHelper::mapEntityId (intval ($ value ), $ this ->migrationMap , $ entityType );
461462 $ value = [$ mappedValue ];
462463 } elseif (is_string ($ value ) && strpos ($ value , ', ' ) !== false ) {
463464 $ ids = array_map ('trim ' , explode (', ' , $ value ));
464465 $ mappedValues = [];
465466 foreach ($ ids as $ id ) {
466467 if (is_numeric ($ id ) || ctype_digit ($ id )) {
467- $ mappedValue = MigrationHelper::mapEntityId (intval ($ id ), $ this ->migrationMap );
468+ $ mappedValue = MigrationHelper::mapEntityId (intval ($ id ), $ this ->migrationMap , $ entityType );
468469 $ mappedValues [] = $ mappedValue ;
469470 }
470471 }
@@ -519,13 +520,13 @@ private function convertCcmToTargetCms($ccmItems, $targetCms, $targetType) {
519520 $ value = $ value ->ID ;
520521 error_log ("[MigrationModel] Extracted ID from object for id_map: " . $ value );
521522 }
522- $ value = MigrationHelper::mapEntityId ($ value , $ this ->migrationMap );
523+ $ value = MigrationHelper::mapEntityId ($ value , $ this ->migrationMap , $ entityType );
523524 }
524525 break ;
525526 }
526527 } else {
527528 if (($ type === 'string ' || $ type === 'integer ' ) && !empty ($ value )) {
528- $ value = MigrationHelper::mapEntityId ($ value , $ this ->migrationMap );
529+ $ value = MigrationHelper::mapEntityId ($ value , $ this ->migrationMap , $ entityType );
529530 }
530531 }
531532
0 commit comments