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 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
Comment #2
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedIt 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 methodisAnonymous()
, 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.
Comment #3
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedThere is already an existing issue about this in ECK: #2673540: EckEntity not implementing EntityOwnerInterface correctly: getOwner() should return \Drupal\user\UserInterface..
Comment #4
MurzThanks, 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.
Comment #5
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@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.