Exception messages in FieldConfig::getFieldStorageDefinition() are inaccurate

Created on 1 June 2017, about 7 years ago
Updated 20 April 2024, about 2 months ago

Problem/Motivation

https://api.drupal.org/api/drupal/core%21modules%21field%21src%21Entity%...

This throws N exception with a message
"Attempted to create an instance of field with name {$this->field_name} on entity type {$this->entity_type} when the field storage does not exist.");

"Attempted to create a configurable field of non-configurable field storage {$this->field_name}."

However, this method is not only called when creating a field, but also in preSave(), calculateDependencies(), preDelete(), and postDelete()

Proposed resolution

Update the error message to be more generic, to account for situations other than field creation.

"Attempted to create, modify or delete an instance of field with name {$this->field_name} on entity type {$this->entity_type} when the field storage does not exist.");

"Attempted to create, modify or delete a configurable field of non-configurable field storage {$this->field_name}."

Remaining tasks

  1. Review MR
  2. Commit

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

πŸ› Bug report
Status

Fixed

Version

10.3 ✨

Component
FieldΒ  β†’

Last updated 2 days ago

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

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.69.0 2024