Closed (fixed)
Project:
Migrate Plus
Version:
8.x-5.0-rc1
Component:
Plugins
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 May 2018 at 09:29 UTC
Updated:
25 Sep 2019 at 11:12 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jian he commentedComment #3
heddnAny chance we can show some tests of this in action?
Comment #4
Merkator commentedHere is it ! A patch with change from Jian He and a new test with more than one field in values definition.
Let me know if something miss.
Comment #5
Merkator commentedRemove Needs Tests tag.
Comment #6
ultimikeI just manually tested this patch with a migration I'm working on and it appears to work as advertised.
-mike
Comment #7
heddnCan we keep the whitespace changes to a minimum here? I see what looks like a pretty small change taking up 25k in the patch. Very hard to review this thing.
Comment #8
mikemadison commentedDoes not apply for me on the most recent dev via composer.
Comment #9
k4v commentedHere is a reroll for the current dev
Comment #10
k4v commentedComment #12
k4v commentedPatch works for me... Not sure about the testing stuff....
Comment #13
nicholasthompsonI had to tweak patch #4 to get it to work with a processed field (without this change I had lots of error about trying to Get an NestedArray).
My Setup is something like this:
process: type: plugin: default_value default_value: MY_TYPE title: title 'body/value': description field_video: plugin: entity_generate source: id value_key: field_media_oembed_video entity_type: media bundle: remote_video values: name: title field_media_oembed_video: plugin: MY_PLUGIN source: idHowever I have not looked into the tests..
Comment #14
nicholasthompsonOk... something went weird on that patch and it wouldn't apply to the dev branch. I've manually reapplied the changes, reviewed the test change (which looks like it just moved everything out of a fixed array and into a $info variable? So I skipped that change) and rebuilt my patch.
Comment #15
sonnyktThe patch from #14 works with Migrate Plus 8.x-4.1 I am able to create media images with the patch.
Without the patch, all fields name, field_media_caption, field_media_image are always array of processed values from
Comment #17
joekersConfirming the above - #14 is working well for me too! Thanks for the patch!
Comment #18
heddnCan we add some tests? NW for tests. Also, can we check the major version of Drupal and use the new Row::get methodology if we are running 8.7? See https://www.drupal.org/node/3001535
Comment #19
heddnAlso, this is more of a task than a bug.
Comment #20
sonnyktI just reckoned that EntityGenerate does not support nested values, eg. field_description/value or field_link/uri does not work.
will result in
instead of the expected values
The below patch uses NestedArray::setValue() (like Row::setDestinationProperty()) to set the nested values.
Comment #21
skdrupal88#20 Works well to me. Thanks!
Comment #22
jian he commentedThis is bug. Because the running result is not the same as what the document of class EntityGenerate say.
Comment #23
jian he commentedComment #24
jian he commentedComment #25
jian he commentedAdd automated test.
Comment #26
jian he commentedComment #27
jian he commentedAutomated test already provided
Comment #28
jian he commented1. Fix #18, check the major version of Drupal and use the new Row::get methodology if running on 8.7
2. Remove miss added nested process plugin, because we already have @destination supported.
Comment #29
heddnVery close. Tagging novice since this should be pretty trivial.
Let's call this processPluginManager?
Can we add a TODO and a link to an issue that is postponed to remove this logic once 8.6 is no longer supported?
Comment #30
jian he commentedThanks for the great review.
Comment #31
heddnLooking good.
Comment #32
coufu commentedGreat patch. Thanks all for the hard work.
Comment #33
heddnComment #35
heddnComment #37
l0keIs possible to create a release that will include this fix? I would say it's quite a major bug!
Comment #38
pcate commentedI've tried using this functionality with v5.0RC, but can't seem to get it working. I'm trying to generate missing taxonomy terms with it, but also add the description and description format at the same time. Here's the yaml:
The terms are generated fine with the correct name, but the description and format are not imported. Am I missed a configuration option or how this process plugin works? Appreciate any help.
Comment #39
gueguerreiro@PCate, the format needs to be inside the 'default_values' configuration, and not 'values', since it's using an hardcoded value.
So:
Regardless, there's currently a problem processing array properties inside default_values. I opened up an issue here: https://www.drupal.org/project/migrate_plus/issues/3082060#comment-13262940 with a patch you can use to fix it.
Comment #40
stefan vaduva commentedI've installed the latest version and tried to use the following code:
Although contact_name, contact_description, email and phone_number have correct values, the point_of_contact node is not added in the database. Is there anything that I still need to do in order to have the entity created?
Comment #41
gueguerreiro@stefan-vaduva it seems you're missing the
sourceandvalue_key. Entity Generate checks if an entity already exists before creating it. You need to give it something to look for.In your example, you could use the title, for example.
So, your end result should be:
Comment #42
stefan vaduva commentedThank you! I thought that the source & value_key are not mandatory if you just want to create it without looking for an existing one. Now it works
Comment #43
gueguerreiroNo problem, I'm glad you got it working :) To offer more information, it needs those values because Entity Generate is an extension of the Migration Lookup process plugin.