diff --git a/custom/modules/loyalist_migrate/config/install/migrate_plus.migration.0_loyalist_migrate_loyalist_items.yml b/custom/modules/loyalist_migrate/config/install/migrate_plus.migration.0_loyalist_migrate_loyalist_items.yml index bb79ae2..a39a64f 100644 --- a/custom/modules/loyalist_migrate/config/install/migrate_plus.migration.0_loyalist_migrate_loyalist_items.yml +++ b/custom/modules/loyalist_migrate/config/install/migrate_plus.migration.0_loyalist_migrate_loyalist_items.yml @@ -19,6 +19,14 @@ process: bundle_key: vid bundle: issuing_body value_key: name + field_subject_heading: + - + plugin: entity_generate + source: subject_heading_name + entity_type: taxonomy_term + bundle_key: vid + bundle: subject_heading + value_key: name destination: plugin: 'entity:node' diff --git a/custom/modules/loyalist_migrate/src/Plugin/migrate/source/LoyalistItem.php b/custom/modules/loyalist_migrate/src/Plugin/migrate/source/LoyalistItem.php index 1244240..60cf2a0 100644 --- a/custom/modules/loyalist_migrate/src/Plugin/migrate/source/LoyalistItem.php +++ b/custom/modules/loyalist_migrate/src/Plugin/migrate/source/LoyalistItem.php @@ -23,14 +23,20 @@ public function query() { $query = $this->select('node', 'n'); $query->condition('n.type', 'loyalist_record'); - $query->join('field_data_field_accompanying_record', 'fac', 'n.nid = fac.entity_id AND fac.deleted = 0'); - $query->join('field_data_field_issuing_body', 'fib', 'n.nid = fib.entity_id AND fib.deleted = 0'); - $query->join('taxonomy_term_data', 'ttd', 'fib.field_issuing_body_tid = ttd.tid'); - $query->addField('n', 'nid', 'nid'); $query->addField('n', 'title', 'title'); + + $query->join('field_data_field_accompanying_record', 'fac', 'n.nid = fac.entity_id AND fac.deleted = 0'); $query->addField('fac', 'field_accompanying_record_value', 'field_accompanying_record_value'); - $query->addField('ttd', 'name', 'issuing_body_name'); + + $query->join('field_data_field_issuing_body', 'fib', 'n.nid = fib.entity_id AND fib.deleted = 0'); + $query->join('taxonomy_term_data', 'ttdfib', 'fib.field_issuing_body_tid = ttdfib.tid'); + $query->addField('ttdfib', 'name', 'issuing_body_name'); + + $query->join('field_data_field_subject_heading', 'fsh', 'n.nid = fsh.entity_id AND fsh.deleted = 0'); + $query->join('taxonomy_term_data', 'ttdfsh', 'fsh.field_subject_heading_tid = ttdfsh.tid'); + $query->addField('ttdfsh', 'name', 'subject_heading_name'); + return $query; } @@ -44,6 +50,7 @@ public function fields() 'title' => 'title', 'field_accompanying_record_value' => 'field_accompanying_record_value', 'issuing_body_name' => 'issuing_body_name', + 'subject_heading_name' => 'subject_heading_name', ]; return $fields; }