Attempt to create a base field bundle override of field bundle without a bundle

Created on 18 September 2024, 3 months ago
Updated 20 September 2024, 3 months ago

Problem/Motivation

The error above appearing in my drupal watchdog and an error page, when accessing a french version of a site.

Steps to reproduce

On a multilingual drupal site 10.3.5, with a view of entities of type civievent, using both 4.0.0-beta4 and the latest 4.0 dev and including this patch: https://github.com/eileenmcnaughton/civicrm_entity/pull/497/files

On the line 246 of civicrm_entity.module I get this error:

Drupal\Core\Field\FieldException: Attempt to create a base field bundle override of field id without a bundle in Drupal\Core\Field\Entity\BaseFieldOverride->__construct() (line 110 of /var/www/drupal/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php).

With further debugging inserted, I can see that it's trying to execute:

$field = BaseFieldOverride::createFromBaseFieldDefinition($base_field_definitions[$field_name], $bundle);

But $bundle is empty. In the view, I do specify a specific civievent type, though I'm not clear that's the same as a bundle, though I'd assume so.

I can avoid the error by just testing for an empty bundle at the top of civicrm_entity_entity_bundle_field_info.

Proposed resolution

Before I added the patch 497, I was getting a different error. I wonder if that patch is incomplete in some way?

Or is it in the views integration not declaring a bundle?

Or is everything correct and that function just needs to quit if no bundle is declared?

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada adixon

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

Comments & Activities

Production build 0.71.5 2024