EntityStorageException if no fields selected

Created on 17 July 2024, 5 months ago

Drupal\Core\Entity\EntityStorageException: Field is unknown. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

When configuring content type to send notification to on publish, if you do not specify body and icon, then you get EntityStorageException

changing

    // Prepare a notification info.
    if (isset($fields['body'])) {
      $item->body = $entity->get($fields['body'])->value;
    }

    // Prepare a notification icon.
    if (isset($fields['icon'])) {
      $item->icon = $this->getIconUrl($entity->get($fields['icon']));
    }

to

    // Prepare a notification info.
    if (isset($fields['body']) && !empty($fields['body'])) {
      $item->body = $entity->get($fields['body'])->value;
    }

    // Prepare a notification icon.
    if (isset($fields['icon']) && !empty($fields['icon'])) {
      $item->icon = $this->getIconUrl($entity->get($fields['icon']));
    }

in

web/modules/contrib/web_push_notification/src/NotificationQueue.php

for now.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom 2dareis2do

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024