Explorar o código

migration: cutting nosample location to memo #nosample

bach %!s(int64=4) %!d(string=hai) anos
pai
achega
c2a23a9e5b

+ 13 - 0
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeMateriau.php

@@ -166,6 +166,19 @@ class D7NodeMateriau extends FieldableEntity {
       }
     }
 
+    //location (samples)
+    $locations = [];
+    if(!empty($row->getSourceProperty('field_location'))){
+      foreach ($row->getSourceProperty('field_location') as $key => $value) {
+        if ($value['location'] == 'no sample') {
+          $memo .= "#nosample (".$value["showroom_tid"].")\n";
+        }else{
+          $locations[] = $value;
+        }
+      }
+    }
+    $row->setSourceProperty('field_location', $locations);
+
     // workflow
     $query = $this->select('workflow_node', 'wn');
     $query->fields('wn', ['sid']);