I try to import JsonPath feed into ECK target entities. Via simple mapping like title all works well, but when I do more complex mapping - I got the error:
Error: Call to undefined method Drupal\Core\Field\EntityReferenceFieldItemList::isAnonymous() in Drupal\feeds\Feeds\Processor\EntityProcessorBase->entitySaveAccess() (line 492 at modules/contrib/feeds/src/Feeds/Processor/EntityProcessorBase.php)

If I use same mapping when importing into Node targets - all works without error.

Is this ECK issue or Feeds?

Comments

Murz created an issue. See original summary.

MegaChriz’s picture

It could be that the owner of an ECK entity isn't an account, what Feeds expects. Feeds calls getOwner() on the entity when that implements the interface \Drupal\user\EntityOwnerInterface. That method is expected to return an object that implements \Drupal\user\UserInterface. Objects implementing that interface should have a method isAnonymous(), the method that Feeds calls.

So I think the bug is in ECK here. According to the code I see on https://cgit.drupalcode.org/eck/tree/src/Entity/EckEntity.php?h=8.x-1.x that appears to be true. ECK is not implementing \Drupal\user\EntityOwnerInterface correctly.

MegaChriz’s picture

Status: Active » Closed (duplicate)
Murz’s picture

Thanks, applying the patch from #2673540: EckEntity not implementing EntityOwnerInterface correctly: getOwner() should return \Drupal\user\UserInterface. solves the problem! Strange that I can't find that ECK issue before creating this.

MegaChriz’s picture

@Murz
I searched explicitly for "getOwner" in the ECK issue queue. In the existing issue that I found people got a different error message (an other method that was missing from \Drupal\user\UserInterface), so I think that is why you didn't find it.