Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have an entity reference field that has 2 taxonomies being referenced. This makes my CSV import bomb out. Is there a way to tell the plugin entity_lookup/generate that there are two taxonomies in use? Here's my config yml (problem in field_interacting_drug):
id: interactiontest
label: Migrate Detailed Interactions
migration_group: interaction_import
source:
plugin: csv
path: import/interaction-test.csv
header_row_count: 1
keys:
- uuid
delimiter: '|'
column_names:
0:
uuid: uuid
1:
arv: arv
2:
arv_dose: arv dose
3:
arv_effect: arv effect
4:
interacting_drug: interacting drug
5:
interacting_drug_dose: interacting drug dose
6:
interacting_drug_effect: interacting drug effect
7:
mechanism: mechanism
destination:
plugin: entity:node
process:
type:
plugin: default_value
default_value: detailed_interactions
field_arv_drug:
plugin: entity_generate
source: arv
field_arv_dose: arv_dose
field_effect_on_arv: arv_effect
field_interacting_drug:
plugin: entity_generate
source: interacting_drug
field_interacting_drug_dose: interacting_drug_dose
field_effect_on_interacting_drug: interacting_drug_effect
field_mechanism: mechanism
Comment | File | Size | Author |
---|---|---|---|
#11 | migrate_plus-entity_lookup_generate-8.x.4.x-2835915-11-D8.patch | 909 bytes | somersoft |
#3 | entity reference for two vocab.png | 16.91 KB | Ada Hernandez |
#3 | entity_lookup_generate-8.x.2.x-2835915-3.patch | 723 bytes | Ada Hernandez |
#3 | entity_lookup_generate-8.x.3.x-2835915-3.patch | 723 bytes | Ada Hernandez |
Comments
Comment #2
Ada Hernandez CreditAttribution: Ada Hernandez at MTech, LLC commentedchecking this!
Comment #3
Ada Hernandez CreditAttribution: Ada Hernandez at MTech, LLC commentedif you have 2 vocabulary always there's one what is by default to store the new item, so in the migration'll take that, but I tested that and a exception is thrown because in entity_lookup plugin there's a extra reset function, so I removed this and works!
Comment #4
Ada Hernandez CreditAttribution: Ada Hernandez at MTech, LLC commentedComment #5
jaysonjaynes CreditAttribution: jaysonjaynes commentedThank you so much! Hmm...it's not working for me. I'm using entity_generate. Is that the same thing? What does your YML file look like?
Comment #6
jaysonjaynes CreditAttribution: jaysonjaynes commentedI tried entity_lookup and it didn't work...
Comment #7
Ada Hernandez CreditAttribution: Ada Hernandez at MTech, LLC commented@jaysonjaynes, you can check this blog, maybe it can help you with your migrations template, ...: https://www.mtech-llc.com/blog/ada-hernandez/how-migrate-images-drupal-8... and https://www.mtech-llc.com/blog/ada-hernandez/entity-lookup-generate-migr...
Comment #8
jaysonjaynes CreditAttribution: jaysonjaynes commentedThanks, @adita! I've seen those and will review them again.
Comment #9
heddnLet's add a kernel test for this where the destination field has two term bundles possible for it. Back to NW for tests.
Comment #10
kobb CreditAttribution: kobb commentedSo glad this is being discussed. I am running into the same issue. I've tried this:
But it only records the last entity_lookup processed.
EDIT: I realize now my problem is slightly different than the origin of this thread. I have two columns in my CSV that are being migrated into one node reference field with two possible content types. So the hard part is already done before the migration. I just need it to migrate both sets of references into one field.
Comment #11
somersoft CreditAttribution: somersoft commentedIn my case, Entity Generate was being called with an array for $value and not a single value. The patch iterators over the passed values. It can then cope with all cases where entities are missing or present.
Part of example migration configuration .yml
Comment #12
badrange CreditAttribution: badrange at Digia commentedsomersoft: I had a similar issue like you; but with my own custom process plugin. Adding
to my custom plugin resolved this for me. I'm not saying you haven't collided with a bug, I'm just saying that in my case changing my migration process plugin solved it. If you want this fixed, I suggest creating a new issue with your patch.
Comment #13
seth.e.shaw CreditAttribution: seth.e.shaw commented@Kobb: did you ever find a solution to doing lookups across multiple content types?
Comment #14
heddnThere's sub_process to cope with arrays. And there's the recent SingleValue and MultipleValues that could also help. Still needs work because needs tests.
I'm going to suggest this is fixable with one of those solutions. I'll probably be proved wrong, but let's see if we can cleanup the issue queue.
Comment #15
kobb CreditAttribution: kobb commented@seth.e.shaw: No. I ended up creating a new field to import the second entity reference.