Skip to content

Commit

Permalink
LOYALIST-58 Add remaining plain text fields to record migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jtmcd75 committed Jul 17, 2024
1 parent ddea99d commit 779d2ae
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,34 @@ migration_tags:
source:
plugin: loyalist_item
key: migrate

process:
nid: nid
title:
plugin: callback
callable: trim
source: title

body/value: field_contents_value
body/format:
plugin: default_value
default_value: wysiwyg

field_accompanying_record:
plugin: callback
callable: trim
source: field_accompanying_record_value

field_call_number:
plugin: callback
callable: trim
source: field_call_number_value
field_accompanying_record: field_accompanying_record_value

field_document_id:
plugin: callback
callable: trim
source: field_document_id_value

field_issuing_body:
-
plugin: entity_generate
Expand All @@ -27,6 +44,27 @@ process:
bundle_key: vid
bundle: issuing_body
value_key: name

field_gauge:
plugin: callback
callable: trim
source: field_gauge_value

field_number_of_sources:
plugin: callback
callable: trim
source: field_number_of_sources_value

field_other_numbers/value: field_other_numbers_value
field_other_numbers/format:
plugin: default_value
default_value: wysiwyg

field_record_info:
plugin: callback
callable: trim
source: field_record_info_value

field_subject_heading:
-
plugin: entity_generate
Expand All @@ -35,14 +73,11 @@ process:
bundle_key: vid
bundle: subject_heading
value_key: name
field_other_numbers/value: field_other_numbers_value
field_other_numbers/format:
plugin: default_value
default_value: wysiwyg
body/value: field_contents_value
body/format:
plugin: default_value
default_value: wysiwyg

field_volume_info:
plugin: callback
callable: trim
source: field_volume_info_value

destination:
plugin: 'entity:node'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,37 @@ public function query()
$query->addField('n', 'nid', 'nid');
$query->addField('n', 'title', 'title');

$query->leftJoin('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->leftJoin('field_data_field_call_number', 'fcn', 'n.nid = fcn.entity_id AND fcn.deleted = 0');
$query->addField('fcn', 'field_call_number_value', 'field_call_number_value');

$query->leftJoin('field_data_field_contents', 'fcon', 'n.nid = fcon.entity_id AND fcon.deleted = 0');
$query->addField('fcon', 'field_contents_value', 'field_contents_value');

$query->leftJoin('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->leftJoin('field_data_field_document_id', 'fdid', 'n.nid = fdid.entity_id AND fdid.deleted = 0');
$query->addField('fdid', 'field_document_id_value', 'field_document_id_value');

$query->leftJoin('field_data_field_other_numbers', 'fon', 'n.nid = fon.entity_id AND fon.deleted = 0');
$query->addField('fon', 'field_other_numbers_value', 'field_other_numbers_value');
$query->leftJoin('field_data_field_gauge', 'fg', 'n.nid = fg.entity_id AND fg.deleted = 0');
$query->addField('fg', 'field_gauge_value', 'field_gauge_value');

$query->leftJoin('field_data_field_issuing_body', 'fib', 'n.nid = fib.entity_id AND fib.deleted = 0');
$query->leftJoin('taxonomy_term_data', 'ttdfib', 'fib.field_issuing_body_tid = ttdfib.tid');
$query->addField('ttdfib', 'name', 'issuing_body_name');

$query->leftJoin('field_data_field_number_of_sources', 'fns', 'n.nid = fns.entity_id AND fns.deleted = 0');
$query->addField('fns', 'field_number_of_sources_value', 'field_number_of_sources_value');

$query->leftJoin('field_data_field_record_info', 'fri', 'n.nid = fri.entity_id AND fri.deleted = 0');
$query->addField('fri', 'field_record_info_value', 'field_record_info_value');

$query->leftJoin('field_data_field_subject_heading', 'fsh', 'n.nid = fsh.entity_id AND fsh.deleted = 0');
$query->leftJoin('taxonomy_term_data', 'ttdfsh', 'fsh.field_subject_heading_tid = ttdfsh.tid');
$query->addField('ttdfsh', 'name', 'subject_heading_name');

$query->leftJoin('field_data_field_call_number', 'fcn', 'n.nid = fcn.entity_id AND fcn.deleted = 0');
$query->addField('fcn', 'field_call_number_value', 'field_call_number_value');
$query->leftJoin('field_data_field_volume_info', 'fvi', 'n.nid = fvi.entity_id AND fvi.deleted = 0');
$query->addField('fvi', 'field_volume_info_value', 'field_volume_info_value');

return $query;
}
Expand Down

0 comments on commit 779d2ae

Please sign in to comment.