Closed (fixed)
Project:
Commerce Migrate
Version:
8.x-2.x-dev
Component:
Ubercart D6
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Aug 2017 at 18:01 UTC
Updated:
4 Jan 2018 at 19:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
heddnMake sure the attribute name follows the machine name format rules, cut the length, then dedupe it. make sure when cutting the length that the dedupe process doesn't make the length go over 32 characters again.
https://www.drupal.org/docs/8/api/migrate-api/migrate-process/process-pl...
https://www.drupal.org/docs/8/api/migrate-api/migrate-process-plugins/pr...
https://www.drupal.org/docs/8/api/migrate-api/migrate-process/process-pl...
Comment #3
willeaton commentedPatch fixing this attached. Name/ID/machine_name is limited to 20 characters because things like "attribute_" is added as a prefix and dedup can add stuff at the end
Comment #5
willeaton commentedPatch failed because I was deduping things that are ok to be duplicates. Adding new patch file
Comment #6
willeaton commentedComment #7
willeaton commentedCan someone help? Is this an error because the data doesn't import properly now or because there is something wrong with the test?
Comment #8
quietone commentedPatch looks good, just one question.
Please remind me why the attribute id in d6_ubercart_product_attribute can be a duplicate.
Comment #9
willeaton commentedIn the D8 model the attribute is duplicated for every attribute value I think. I realised this when the first patch failed the tests (see patch 1 test results). As I can't migrate products or nodes atm with the other patches I have applied I'm not sure. Can someone from D8 side check it's fine?
Comment #10
willeaton commentedComment #11
heddnThis looks good. Values can be duplicated.
Does this need to map up with d6_ubercart_field_attribute? Can/should we have a test for this?
Comment #12
willeaton commentedHonestly, I don't know, this is where a D8 commerce person needs to evaluate. I believe
/modules/ubercart/migration_templates/d6_ubercart_field_attribute.yml
had to be shorter (string limit 20) because it prefixes with "attribute_". Therefore it doesn't look like they need to match although it would make sense...
Comment #13
quietone commentedThe is deduping the d6 field name, should dedupe the d8 storage name, field_name.
And add a comment as to why the length is 20. That will catch some up in the future.
Needs a new line.
As for the tests, adding an attribute with a long name to the test fixture should provide the data.
Comment #14
quietone commentedWent back to the beginning to see what D8 does what creating a product attribute. When an attribute is created through the UI in D8, both field storage config and field instance config are created. The latter does not have a migration.
After using drush to migrate d6_ubercart_product_attribute and d6_ubercart_product_attribute the atatirbutes and not the field config the attributes seem to work fine through the UI. Don't fully understand how about fields and storage and instances. I would think something would break if the config and instances wasn't created. Or, I didn't test something that would fail.
Then I added a test for the problem at hand, the names > 32 character. For that I looked at the taxonomy vocabulary migration and used the way the deduping is done there. That all seems to work now.
Still to do is to review the field storage migration and to create a field instance migration.
Comment #15
willeaton commentedRerolled the patch as it failed to apply with the new alpha2 version. I completely removed the changes to tests and uc6 fixture as this only created complicated conflicts. Need to add them back in.
As per quietone's last comment...
Still to do is to review the field storage migration and to create a field instance migration.
Comment #16
willeaton commentedHi all, this seems to have gone into alpha2 which fixed one issue (error on migrate due to attribute names being too long for D8 when coming from D6). The new issue is that we've broken the attribute relationship in D8 and after doing a full migration I get a great big error...
PHP Fatal error: Call to a member function getSetting() on null in web/modules/contrib/commerce/modules/product/commerce_product.views.inc on line 28
Whats happening is that the field storage bundle is empty because (I think) the attribute table its looking for doesn't exist.
We have 3 migrations:
d6_ubercart_attribute_value.yml
d6_ubercart_product_attribute.yml
d6_ubercart_field_attribute.yml
and the attribute name/id/machine name isn't migrated in the same way in either
Comment #17
willeaton commentedOK, I've learned from my mistakes and I now have attributes reduced to a max length, deduped, AND now they match between the 3 migrations doing a migration_lookup. Basically I have a d6 to d8 migration working with attributes. Patch attached (based on alpha2).
New problem, the attributes don't seem to be associated to the products in D8 and Im not sure where in the D8 database an attribute is associated to a product. Can someone please tell me what table? @mglaman?
Comment #18
willeaton commentedSetting to NR for testbot
Comment #20
quietone commentedChange an existing attribute name to be longer than 32 characters.
Comment #22
quietone commentedChange tests to use the new longer attribute name. Modified the input to assertProductAttributeEntity to be simpler. And some comment changes.
Comment #24
quietone commentedWith #2915878: Call to a member function getSetting() on null this patch installed locally the failing test passes.
Now postponing on #2915878: Call to a member function getSetting() on null .
Comment #25
quietone commentedNo longer postponed
Comment #26
quietone commentedTesting
Comment #27
quietone commentedThis will need a reroll after #2920662: Fix attribute dependencies and field settings is committed. Let's wait on that.
Comment #28
willeaton commentedWith the latest patch, the attributes dont seem to get set up.
I see this error:
Attempt to create a field attribute_yate_exclusivo_baja_al that does not exist on entity type commerce_product_variation
I then also get the old error:
Call to a member function getSetting() on null in /web/modules/contrib/commerce/modules/product/commerce_product.views.inc on line 28
This used to happen before when the attributes didn't migrate properly. Something has stopped working...
Comment #29
quietone commentedNo longer postponed.
Comment #30
quietone commentedAll the attribute migrations now use migration_lookup to get the field name from d6_ubercart_attribute_field. Tests updated as required for the attribute with a name longer than 32 characters.
Comment #31
heddnLooks good to me. Almost entirely yml file changes. With a few tests. So, LGTM.
Comment #32
heddn