EntityMalformedException: field_collection_item in entity_extract_ids

Created on 5 August 2021, over 3 years ago
Updated 8 April 2024, 9 months ago

Problem/Motivation

As a part of recent Drupal core update ; field_sql_storage_field_storage_write function got updated to include additional check when updating or saving entities.

The commit for the same is
https://git.drupalcode.org/project/drupal/-/commit/975e9c60406812cdd2279...

This introduced an additional check, which verifies $entity->original & uses that when invoking entity_extract_ids function
https://git.drupalcode.org/project/drupal/-/blob/7.x/modules/field/modul...

The uuid_features module for field_collection, sets this value as TRUE here
https://git.drupalcode.org/project/uuid_features/-/blob/7.x-1.x/includes...

Hence; this throws as error as below

WD field_collection_item: EntityMalformedException: Missing bundle property on entity of type field_collection_item. in entity_extract_ids() (line 8026 of includes/common.inc).

Proposed resolution

Update this line to $field_collection_item['original'] = FALSE;

OR

use hook_uuid_entity_features_rebuild_alter to update the $entity->original value

/**
 * Implements hook_uuid_entity_features_rebuild_alter().
 */
function <module>_uuid_entity_features_rebuild_alter($entity_type, &$entity, $data, $module) {
  if ($entity_type === 'field_collection_item') {
    $entity->original = FALSE;
  }
}
🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇺🇸United States sumachaa

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024