Views throws exception when using entity_field_storage_info

Created on 12 October 2015, over 9 years ago
Updated 23 November 2023, over 1 year ago

Problem/Motivation

The views module throws an exception when a entity type was modified using the entity_field_storage_info hook.

The exception is raised in EntityViewsData::mapFieldDefinition() around line 295. It's caused by a loop in EntityViewsData::getViewsData() around line 218. The method scans all fields returned by a table mapping and relies on all fields being registered through EntityManager::getBaseFieldDefinitions(). However, if you manipulate the fields using the hook entity_field_storage_info, those fields won't show up within the base field definitions.

Proposed resolution

The easiest solution would be to add a check of whether a field is available within the base field array. I've included a path that does right that.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Viewsย  โ†’

Last updated 2 days ago

Created by

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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