Error when saving a new field without an association TypeError: Illegal offset type in Drupal\Core\Entity\EntityStorageBase->load()

Created on 19 November 2023, 12 months ago
Updated 13 January 2024, 10 months ago

Problem/Motivation

Error when saving a new field without an association
TypeError: Illegal offset type in Drupal\Core\Entity\EntityStorageBase->load(target_id)
Because the target id is a array, add check if it isn't array for get the entity block

     if(!is_array($value['target_id'])) {
        $entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($value['target_id']);
        // Add the current revision ID.
        $values[$key]['target_revision_id'] = $entity->getRevisionId();
      }
🐛 Bug report
Status

Postponed: needs info

Version

1.10

Component

Code

Created by

🇻🇳Vietnam son.nguyen

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024