Inherit log uid, created and changed properties when migrating quantities.

This commit is contained in:
paul121 2020-11-16 09:06:56 -08:00 committed by Michael Stenta
parent 99e8fb77fa
commit 667531d3d3
13 changed files with 110 additions and 3 deletions

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -43,6 +49,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -43,6 +49,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -35,6 +35,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -45,6 +51,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -43,6 +49,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -43,6 +49,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -43,6 +49,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -43,6 +49,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -43,6 +49,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -43,6 +49,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -33,6 +33,12 @@ process:
plugin: sub_process
source: log_quantities
process:
# Save the uid as a pseudo value.
_uid:
plugin: migration_lookup
migration: farm_migrate_user
source: uid
no_stub: true
# Save the units term as a pseudo value.
_units:
plugin: migration_lookup
@ -43,6 +49,9 @@ process:
target_id:
plugin: create_quantity
values:
uid: '@_uid'
created: created
changed: changed
units: '@_units'
label: label
measure: measure

View File

@ -141,6 +141,11 @@ class FarmLog extends Log {
// Set the "is_movement" property for use in migrations.
$row->setSourceProperty('is_movement', $is_movement);
// Get values from the log that will be inherited to created quantities.
$log_uid = $row->getSourceProperty('uid');
$log_created = $row->getSourceProperty('created');
$log_changed = $row->getSourceProperty('changed');
// Get quantity log field value.
$quantity_values = $this->getFieldvalues('log', 'field_farm_quantity', $id);
@ -177,7 +182,15 @@ class FarmLog extends Log {
$query->addField('fdffqv', 'field_farm_quantity_value_denominator', 'value_denominator');
// Execute the query.
$log_quantities[] = $query->execute()->fetchAssoc();
$quantity_data = $query->execute()->fetchAssoc();
// Add values to inherit from the log.
$quantity_data['uid'] = $log_uid;
$quantity_data['created'] = $log_created;
$quantity_data['changed'] = $log_changed;
// Save the quantity to be created later.
$log_quantities[] = $quantity_data;
}
// Add the quantity logs to the row for future processing.

View File

@ -47,8 +47,6 @@ class CreateQuantity extends ProcessPluginBase implements ContainerFactoryPlugin
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
// TODO: Do the quantity UID, created/changed timestamps need to be
// inherited from the log?
// Start array of entity values.
$entity_values = [];