Add new `ImmutableProperties` constraint

Created on 22 August 2023, over 1 year ago
Updated 22 September 2023, about 1 year ago

Problem/Motivation

Over at 📌 [PP-1] Convert field_storage_config and field_config's form validation logic to validation constraints Postponed , we identified the need for a ImmutableProperties constraint for Field(Storage)Config and BaseFieldOverrideconfig entities.

For example, for the latter, the following config entity properties are considered immutable: field_name, entity_type, bundle and field_type.

However, there are at least a few other uses for this:

  1. Editor config entity (editor.editor.*): format
  2. MediaType config entity (media.type.*): source
  3. EntityViewDisplay config entity (core.entity_view_display.*.*.*): targetEntityType
  4. et cetera.

Steps to reproduce

N/A

Proposed resolution

  1. Extract ImmutablePropertiesConstraint(Validator) from that issue
  2. Add explicit test coverage for the new constraint
  3. Adopt in all config entities in core where it makes sense. In particular, all config entities' ID keys should automatically be immutable by default. That's because config entities are referenced by their IDs in many, many places, explicitly and implicitly, and there are countless places in core where changing a config entity's ID can break your site in unexpected ways. (It would even break config dependencies! ⚠️) So in general, a config entity's ID should never be changed. There will be a way to override this restriction for individual config entity types.

Remaining tasks

  1. ✅ Constraint + test coverage
  2. ✅ Adopt in all relevant config entities
  3. ✅ Update corresponding ConfigEntityValidationTestBase subclasses
  4. ✅ Create change record

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

📌 Task
Status

Fixed

Version

11.0 🔥

Component
Configuration entity 

Last updated 3 days ago

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

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

Comments & Activities

Production build 0.71.5 2024