- Issue created by @sorina.hriban
- πΊπΈUnited States tr Cascadia
if ($entity instanceof EntityOwnerInterface) { - return $entity->getOwner(); + $owner = $entity->getOwner(); + if (is_null($owner) && $entity instanceof ParagraphInterface) { + return \Drupal::currentUser(); + } + return $owner; }
If an entity type implements the
EntityOwnerInterface
, it must have agetOwner()
method, and thatgetOwner()
method must return aUserInterface
. NULL is not a valid return value forgetOwner()
. See https://api.drupal.org/api/drupal/core!modules!user!src!EntityOwnerInter...So the issue here is that the Paragraphs module does not return the proper value from
getOwner()
.Regardless, adding code to special-case paragraph entities would not be an acceptable solution.