Problem/Motivation

The property emptyDestinationProperties of the Row object is set during the execution of MigrateExecutable::import

Before the actual entity save, the Row objects can be altered with an event listener on MigratePreRowSaveEvent

e.g.: $event->getRow()->setDestinationProperty('uid', 1);

But in the case that uid was added before to emptyDestinationProperties by setting a new value on the property does not remove the property from the emptyDestinationProperties array

And this is causing for the example above that EntityContentBase::updateEntity is setting the value NULL for the property and not the value that was set in the event listener MigratePreRowSaveEvent

 foreach ($empty_destinations as $field_name) {
    $entity->$field_name = NULL;
 }

Steps to reproduce

Proposed resolution

within Raw::setDestinationProperty remove the property from the emptyDestinationProperties array

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#9 3561197.patch8.12 KBaurelianzaha

Issue fork drupal-3561197

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aurelianzaha created an issue. See original summary.

aurelianzaha’s picture

Issue summary: View changes
aurelianzaha’s picture

Issue summary: View changes
aurelianzaha’s picture

just found that this issue was solved in 11.x already
https://www.drupal.org/project/drupal/issues/3520065
will backport the MR to solve this is 10.x as well

aurelianzaha’s picture

Status: Active » Needs review
andriy khomych’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, Aurelian Zaha.
It looks good to me.
It seems we should update the description of the issue

within Raw::setDestinationProperty remove the property from the emptyDestinationProperties array

Ideally, we need core maintainer feedback. Those methods are helpful, but it might be a better approach.

aurelianzaha’s picture

thanks Andriy Khomych for the review

Ideally, we need core maintainer feedback. Those methods are helpful, but it might be a better approach.

the approach was approved basically because this was merged to 11.x already https://git.drupalcode.org/project/drupal/-/commit/8326e01e92f2e1857bcd9...
this MR is only a backport of that

aurelianzaha’s picture

StatusFileSize
new8.12 KB

attached a static path for the MR, in case someone else needs that as well

benjifisher’s picture

Status: Reviewed & tested by the community » Needs work

@aurelianzaha, @andriy khomych:

When @longwave committed the fix for #3520065, he wrote,

As a new feature this is only eligible for 11.3.x, I considered backporting to 10.6.x but this doesn't meet the criteria of a critical API addition.

Since Drupal 10 is in maintenance, not active, development, it is covered by the policy for Maintenance minor releases. Those are the criteria that @longwave cited.

In other words, the decision has already been made not to back-port #3520065 to Drupal 10.

I will change the status of this issue to NW for now, in case you want to challenge that decision, but I think the correct status will be "Closed (won't fix)".

quietone’s picture

Status: Needs work » Closed (won't fix)
Issue tags: +Bug Smash Initiative

@benjifisher, thank you the git history for this.

I confirmed the decision made be longwave as explained in #10. That is what he said. This is a won't fix.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.