From 50949743cd7ec891957ea4031a6082a1f9044023 Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Thu, 8 Feb 2018 14:57:19 +0100 Subject: [PATCH] fixed migrations : missing entries, date-range --- .../migrate_plus.migration.d6_edlp_evenements.yml | 3 ++- .../src/Plugin/migrate/source/D6EdlpEvenements.php | 8 +++++++- .../Plugin/migrate/source/D6EdlpTaxonomyTermEntree.php | 10 +++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/sites/all/modules/figli/edlp_migrate/config/install/migrate_plus.migration.d6_edlp_evenements.yml b/sites/all/modules/figli/edlp_migrate/config/install/migrate_plus.migration.d6_edlp_evenements.yml index a978d04c7..948f228ff 100644 --- a/sites/all/modules/figli/edlp_migrate/config/install/migrate_plus.migration.d6_edlp_evenements.yml +++ b/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 diff --git a/sites/all/modules/figli/edlp_migrate/src/Plugin/migrate/source/D6EdlpEvenements.php b/sites/all/modules/figli/edlp_migrate/src/Plugin/migrate/source/D6EdlpEvenements.php index cbcc729ea..780c71edf 100644 --- a/sites/all/modules/figli/edlp_migrate/src/Plugin/migrate/source/D6EdlpEvenements.php +++ b/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']); diff --git a/sites/all/modules/figli/edlp_migrate/src/Plugin/migrate/source/D6EdlpTaxonomyTermEntree.php b/sites/all/modules/figli/edlp_migrate/src/Plugin/migrate/source/D6EdlpTaxonomyTermEntree.php index 0e1231576..fffb60d20 100644 --- a/sites/all/modules/figli/edlp_migrate/src/Plugin/migrate/source/D6EdlpTaxonomyTermEntree.php +++ b/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'));