Problem/Motivation
Possibly a bad idea simply because of how big a change it would be...
But ProductVariation source is fundamentally a node migration, with extra data from the uc_products table added.
Currently, it doesn't have access to any CCK fields on the node.
If it inherited from Drupal\node\Plugin\migrate\source\d6\Node, then we'd get those automatically.
Proposed resolution
Option 1: extend it from Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase\FieldableEntity and then have the methods getFields() and getFieldValues() available. There is not patch for this. Fieldable entity is for Drupal 7.
Option 2: extend from Node. The latest patch for this option is #10. It passes tests and solve the problem. However, it is incomplete, and needs a field added and test. Refer to the comment for details.
Remaining tasks
Decide on option
Write patch
test
review etc
Comment | File | Size | Author |
---|---|---|---|
#25 | interdiff.txt | 2.83 KB | quietone |
#25 | 2937634-25.patch | 9.98 KB | quietone |
#23 | 2937634-23.patch | 7.15 KB | quietone |
#20 | interdiff.txt | 792 bytes | quietone |
#20 | 2937634-20.patch | 9.67 KB | quietone |
Comments
Comment #2
quietone CreditAttribution: quietone as a volunteer commentedOr extend it from Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase\FieldableEntity and then have the methods getFields() and getFieldValues() available.
Comment #3
quietone CreditAttribution: quietone at Acro Commerce commentedYes, let's extend from Node. Just needed a few tweaks.
Comment #5
quietone CreditAttribution: quietone at Acro Commerce commentedIt looks like the failure is due to translations, which are not enabled for product variations in the tests.
Comment #6
quietone CreditAttribution: quietone at Acro Commerce commentedDid some testing on a fresh install, which included Spanish.
Manually enable translations for all product variation types
Checked the variation table and the translations are there, although they all have the 'default' product variation type. Hmm, there is no migration for product variation types?
Comment #7
quietone CreditAttribution: quietone at Acro Commerce commentedSet component
Comment #8
quietone CreditAttribution: quietone at Acro Commerce commentedSo, what needs to happen here is for the product variation migration to be translation aware. For that to happen the following has been added; a migration for the language content settings for product variations, a migration for product variation types and a migration for product variation translations.
In testing, I learned that product variations only get a translation entry in the db when a field on the product variation is translated. Unfortunately, the current D6 test fixture does not have such a field with a translation. So maybe it would be better to extend from Fieldable entity as suggested in #2.
Comment #10
quietone CreditAttribution: quietone at Acro Commerce commentedAnd add some migrations to the tests.
Comment #11
quietone CreditAttribution: quietone at Acro Commerce commentedUpdate the IS
Comment #13
quietone CreditAttribution: quietone at Acro Commerce commentedComment #14
quietone CreditAttribution: quietone at Acro Commerce commentedTrying to reroll
Comment #16
quietone CreditAttribution: quietone at Acro Commerce commentedMove test file to correct directory.
Comment #18
quietone CreditAttribution: quietone at Acro Commerce commentedSilly me uploaded that same patch with the error.
Comment #20
quietone CreditAttribution: quietone at Acro Commerce commentedFix one error, the entity count.
Comment #22
quietone CreditAttribution: quietone at Acro Commerce commentedUpdate IS
Comment #23
quietone CreditAttribution: quietone at Acro Commerce commentedThis is a reroll of the first patch, in #3. Adding the cck fielk data to the row should be straightforward. The product and product variation migrations passed tests locally now so something has been fixed since Jan that affects this.
Comment #25
quietone CreditAttribution: quietone at Acro Commerce commentedThis patch has reduced the number of product variation from 7 to 5, which was a bit of a surprise. The source has 5 products, 2 of which are translated and the migration creates product variations are created for the translated products. Note the product variations are in the 'en' language which makes sense because product variation translation is not enabled.
I'm preparing locally to run the full migration and check that everything works as expected in the UI. In the meantime, here is a new patch, updating the tests. There is a reduction in the product variation entity count in the full upgrade test, adjusting the rollback test and checking that the two extra product variations are not created.
Comment #26
quietone CreditAttribution: quietone at Acro Commerce commentedYes, a full migration works as expected the 2 translations are there and available via the UI.
Before this patch there were 7 product variations after the migration, the extra two were not linked to a product and there was no test to confirm they did not exist. A test to do just that has been added in the patch in #25.
Comment #27
heddnThe changes here make sense. Tests are also aligned.
Comment #29
heddn