Issue #2272853 by webflo: Fixed CckFieldValues source plugin loses similar field values.
parent
b05990a755
commit
d111ef32a0
|
@ -115,7 +115,7 @@ class CckFieldValues extends DrupalSqlBase implements SourceEntityInterface {
|
||||||
$source = $row->getSource();
|
$source = $row->getSource();
|
||||||
// We diff the results with the source to find any field columns
|
// We diff the results with the source to find any field columns
|
||||||
// in the content type's main table.
|
// in the content type's main table.
|
||||||
$new_fields = array_diff($results, $source);
|
$new_fields = array_diff_key($results, $source);
|
||||||
foreach ($new_fields as $key => $value) {
|
foreach ($new_fields as $key => $value) {
|
||||||
$row->setSourceProperty($key, $value);
|
$row->setSourceProperty($key, $value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -790,6 +790,70 @@ class Drupal6FieldInstance extends Drupal6DumpBase {
|
||||||
)),
|
)),
|
||||||
'description' => 'An example multi-valued decimal field.',
|
'description' => 'An example multi-valued decimal field.',
|
||||||
))
|
))
|
||||||
|
->values(array(
|
||||||
|
'field_name' => 'field_test_identical1',
|
||||||
|
'type_name' => 'story',
|
||||||
|
'weight' => 2,
|
||||||
|
'label' => 'Integer Field',
|
||||||
|
'widget_type' => 'number',
|
||||||
|
'widget_settings' => 'a:2:{s:13:"default_value";a:1:{i:0;a:2:{s:5:"value";s:0:"";s:14:"_error_element";s:41:"default_value_widget][field_int][0][value";}}s:17:"default_value_php";N;}',
|
||||||
|
'display_settings' => serialize(array(
|
||||||
|
'weight' => 2,
|
||||||
|
'parent' => '',
|
||||||
|
'label' => array(
|
||||||
|
'format' => 'above',
|
||||||
|
),
|
||||||
|
'teaser' => array(
|
||||||
|
'format' => 'unformatted',
|
||||||
|
'exclude' => 0,
|
||||||
|
),
|
||||||
|
'full' => array(
|
||||||
|
'format' => 'us_0',
|
||||||
|
'exclude' => 0,
|
||||||
|
),
|
||||||
|
4 => array(
|
||||||
|
'format' => 'unformatted',
|
||||||
|
'exclude' => 0,
|
||||||
|
),
|
||||||
|
5 => array(
|
||||||
|
'format' => 'default',
|
||||||
|
'exclude' => 1,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
'description' => 'An example integer field.',
|
||||||
|
))
|
||||||
|
->values(array(
|
||||||
|
'field_name' => 'field_test_identical2',
|
||||||
|
'type_name' => 'story',
|
||||||
|
'weight' => 2,
|
||||||
|
'label' => 'Integer Field',
|
||||||
|
'widget_type' => 'number',
|
||||||
|
'widget_settings' => 'a:2:{s:13:"default_value";a:1:{i:0;a:2:{s:5:"value";s:0:"";s:14:"_error_element";s:41:"default_value_widget][field_int][0][value";}}s:17:"default_value_php";N;}',
|
||||||
|
'display_settings' => serialize(array(
|
||||||
|
'weight' => 2,
|
||||||
|
'parent' => '',
|
||||||
|
'label' => array(
|
||||||
|
'format' => 'above',
|
||||||
|
),
|
||||||
|
'teaser' => array(
|
||||||
|
'format' => 'unformatted',
|
||||||
|
'exclude' => 0,
|
||||||
|
),
|
||||||
|
'full' => array(
|
||||||
|
'format' => 'us_0',
|
||||||
|
'exclude' => 0,
|
||||||
|
),
|
||||||
|
4 => array(
|
||||||
|
'format' => 'unformatted',
|
||||||
|
'exclude' => 0,
|
||||||
|
),
|
||||||
|
5 => array(
|
||||||
|
'format' => 'default',
|
||||||
|
'exclude' => 1,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
'description' => 'An example integer field.',
|
||||||
|
))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
// Create the field table.
|
// Create the field table.
|
||||||
|
@ -1082,6 +1146,38 @@ Goodbye";s:18:"allowed_values_php";s:0:"";}',
|
||||||
'db_columns' => 'a:1:{s:5:"value";a:5:{s:4:"type";s:7:"numeric";s:9:"precision";s:2:"10";s:5:"scale";s:1:"2";s:8:"not null";b:0;s:8:"sortable";b:1;}}',
|
'db_columns' => 'a:1:{s:5:"value";a:5:{s:4:"type";s:7:"numeric";s:9:"precision";s:2:"10";s:5:"scale";s:1:"2";s:8:"not null";b:0;s:8:"sortable";b:1;}}',
|
||||||
'active' => 1,
|
'active' => 1,
|
||||||
))
|
))
|
||||||
|
->values(array(
|
||||||
|
'field_name' => 'field_test_identical1',
|
||||||
|
'module' => 'number',
|
||||||
|
'type' => 'number_integer',
|
||||||
|
'global_settings' => '',
|
||||||
|
'multiple' => 0,
|
||||||
|
'db_storage' => 1,
|
||||||
|
'db_columns' => serialize(array(
|
||||||
|
'value' => array(
|
||||||
|
'type' => 'int',
|
||||||
|
'not null' => FALSE,
|
||||||
|
'sortable' => TRUE,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
'active' => 1,
|
||||||
|
))
|
||||||
|
->values(array(
|
||||||
|
'field_name' => 'field_test_identical2',
|
||||||
|
'module' => 'number',
|
||||||
|
'type' => 'number_integer',
|
||||||
|
'global_settings' => '',
|
||||||
|
'multiple' => 0,
|
||||||
|
'db_storage' => 1,
|
||||||
|
'db_columns' => serialize(array(
|
||||||
|
'value' => array(
|
||||||
|
'type' => 'int',
|
||||||
|
'not null' => FALSE,
|
||||||
|
'sortable' => TRUE,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
'active' => 1,
|
||||||
|
))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$this->createTable('content_field_test', array(
|
$this->createTable('content_field_test', array(
|
||||||
|
|
|
@ -350,6 +350,18 @@ class Drupal6Node extends Drupal6DumpBase {
|
||||||
'unsigned' => FALSE,
|
'unsigned' => FALSE,
|
||||||
'not null' => FALSE
|
'not null' => FALSE
|
||||||
),
|
),
|
||||||
|
'field_test_identical1_value' => array(
|
||||||
|
'description' => 'Test field column.',
|
||||||
|
'type' => 'int',
|
||||||
|
'unsigned' => TRUE,
|
||||||
|
'not null' => FALSE
|
||||||
|
),
|
||||||
|
'field_test_identical2_value' => array(
|
||||||
|
'description' => 'Test field column.',
|
||||||
|
'type' => 'int',
|
||||||
|
'unsigned' => TRUE,
|
||||||
|
'not null' => FALSE
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'primary key' => array('vid'),
|
'primary key' => array('vid'),
|
||||||
));
|
));
|
||||||
|
@ -361,6 +373,8 @@ class Drupal6Node extends Drupal6DumpBase {
|
||||||
'uid',
|
'uid',
|
||||||
'field_test_three_value',
|
'field_test_three_value',
|
||||||
'field_test_integer_selectlist_value',
|
'field_test_integer_selectlist_value',
|
||||||
|
'field_test_identical1_value',
|
||||||
|
'field_test_identical2_value'
|
||||||
))
|
))
|
||||||
->values(array(
|
->values(array(
|
||||||
'nid' => 1,
|
'nid' => 1,
|
||||||
|
@ -368,6 +382,8 @@ class Drupal6Node extends Drupal6DumpBase {
|
||||||
'uid' => 1,
|
'uid' => 1,
|
||||||
'field_test_three_value' => '42.42',
|
'field_test_three_value' => '42.42',
|
||||||
'field_test_integer_selectlist_value' => '3412',
|
'field_test_integer_selectlist_value' => '3412',
|
||||||
|
'field_test_identical1_value' => 1,
|
||||||
|
'field_test_identical2_value' => 1,
|
||||||
))
|
))
|
||||||
->execute();
|
->execute();
|
||||||
$this->setModuleVersion('content', 6001);
|
$this->setModuleVersion('content', 6001);
|
||||||
|
|
|
@ -83,6 +83,28 @@ class MigrateCckFieldValuesTest extends MigrateNodeTestBase {
|
||||||
'bundle' => 'test_planet',
|
'bundle' => 'test_planet',
|
||||||
))->save();
|
))->save();
|
||||||
|
|
||||||
|
entity_create('field_storage_config', array(
|
||||||
|
'entity_type' => 'node',
|
||||||
|
'field_name' => 'field_test_identical1',
|
||||||
|
'type' => 'integer',
|
||||||
|
))->save();
|
||||||
|
entity_create('field_config', array(
|
||||||
|
'entity_type' => 'node',
|
||||||
|
'field_name' => 'field_test_identical1',
|
||||||
|
'bundle' => 'story',
|
||||||
|
))->save();
|
||||||
|
|
||||||
|
entity_create('field_storage_config', array(
|
||||||
|
'entity_type' => 'node',
|
||||||
|
'field_name' => 'field_test_identical2',
|
||||||
|
'type' => 'integer',
|
||||||
|
))->save();
|
||||||
|
entity_create('field_config', array(
|
||||||
|
'entity_type' => 'node',
|
||||||
|
'field_name' => 'field_test_identical2',
|
||||||
|
'bundle' => 'story',
|
||||||
|
))->save();
|
||||||
|
|
||||||
// Add some id mappings for the dependant migrations.
|
// Add some id mappings for the dependant migrations.
|
||||||
$id_mappings = array(
|
$id_mappings = array(
|
||||||
'd6_field_formatter_settings' => array(
|
'd6_field_formatter_settings' => array(
|
||||||
|
@ -118,6 +140,8 @@ class MigrateCckFieldValuesTest extends MigrateNodeTestBase {
|
||||||
$this->assertEqual($node->field_test_two[1]->value, 20, 'Multi field second value is correct.');
|
$this->assertEqual($node->field_test_two[1]->value, 20, 'Multi field second value is correct.');
|
||||||
$this->assertEqual($node->field_test_three->value, '42.42', 'Single field second value is correct.');
|
$this->assertEqual($node->field_test_three->value, '42.42', 'Single field second value is correct.');
|
||||||
$this->assertEqual($node->field_test_integer_selectlist[0]->value, '3412', 'Integer select list value is correct');
|
$this->assertEqual($node->field_test_integer_selectlist[0]->value, '3412', 'Integer select list value is correct');
|
||||||
|
$this->assertEqual($node->field_test_identical1->value, '1', 'Integer value is correct');
|
||||||
|
$this->assertEqual($node->field_test_identical2->value, '1', 'Integer value is correct');
|
||||||
|
|
||||||
$planet_node = Node::load(3);
|
$planet_node = Node::load(3);
|
||||||
$this->assertEqual($planet_node->field_multivalue->value, 33);
|
$this->assertEqual($planet_node->field_multivalue->value, 33);
|
||||||
|
|
Loading…
Reference in New Issue