Browse Source

fixed migrations : missing entries, date-range

Bachir Soussi Chiadmi 6 years ago
parent
commit
50949743cd

+ 2 - 1
sites/all/modules/figli/edlp_migrate/config/install/migrate_plus.migration.d6_edlp_evenements.yml

@@ -64,7 +64,8 @@ process:
       3: 1
       4: 1
 
-  field_date: field_date
+  field_date/value: date
+  field_date/end_value: date
 
 destination:
   plugin: entity:node

+ 7 - 1
sites/all/modules/figli/edlp_migrate/src/Plugin/migrate/source/D6EdlpEvenements.php

@@ -113,12 +113,18 @@ class D6EdlpEvenements extends D6Node {
     }
     $row_nid = $row->getSourceProperty('nid');
 
-
     // Make sure we always have a translation set.
     if ($row->getSourceProperty('tnid') == 0) {
       $row->setSourceProperty('tnid', $row_nid);
     }
 
+    // date
+    $date_field = $row->getSourceProperty('field_date');
+    $date_value = $date_field[0]['value'];
+    drush_print($date_value);
+
+    $row->setSourceProperty('date', $date_value);
+
     // get the workflow status
     $query = $this->select('workflow_node', 'wn');
     $query->fields('wn', ['sid']);

+ 9 - 1
sites/all/modules/figli/edlp_migrate/src/Plugin/migrate/source/D6EdlpTaxonomyTermEntree.php

@@ -78,15 +78,23 @@ class D6EdlpTaxonomyTermEntree extends DrupalSqlBase {
     $description = $query->execute()
       ->fetchField();
     // drush_print_r($node);
+    // empty enties to keep migrate
+    $empty_entries = array(267, 291, 309, 310);
+
+    if($description == "" && in_array($row->getSourceProperty('tid'), $empty_entries)){
+      $description = "a remplir";
+    }
+
     $row->setSourceProperty('description', $description);
 
-    // TODO : get the node type page:notice from source and add it to notice field
+    // get the node type page:notice from source and add it to notice field
     // find node attached to this term for description
     // get all notice
     $query = $this->select('term_node', 'tn');
     $query->condition('tn.tid', 8 ); // page type notice tid
     $query->addField('tn', 'nid');
     $notices_nids = $query->execute()->fetchCol();
+
     // get all nodes taged with the current entree
     $query = $this->select('term_node', 'tn');
     $query->condition('tn.tid', $row->getSourceProperty('tid'));