foreach() argument must be of type array|object

Created on 22 February 2024, 4 months ago

Problem/Motivation

After a d7 to d10 migration, I'm getting this message each time I clean caches (drush cr) or on an operation where EntityFieldManager.php is called:
foreach() argument must be of type array|object, null given EntityFieldManager.php:539
Digging in EntityFieldManager.php it appears that the message entity_type_id is in cause.

        $bundle_field_maps = $this->keyValueFactory->get('entity.definitions.bundle_field_map')->getAll();
        foreach ($bundle_field_maps as $entity_type_id => $bundle_field_map) {
 (line 539)         foreach ($bundle_field_map as $field_name => $map_entry) {

Is there something wrong in entity.definitions ? apparently $bundle_field_maps ['message'] is empty.
- I deleted all my old message templates coming from d7, I uninstalled message and message_examples, then I reinstalled them but the error appears again.
- With message uninstalled, there is still a value in the database in key_value table:
entity.definitions.bundle_field_map message a:1:{s:31:"field_message_comment_reference";a:2:{s:4:"type";s:16:"entity_reference";s:7:"bundles";a:0:{}}}
I deleted it, cleared caches but the error is still here.
No idea what is producing it.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France erwangel

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

Comments & Activities

Production build 0.69.0 2024