Destination entity does not reflect a new inherited field until its entity form is submitted

Created on 26 May 2023, about 1 year ago

Problem/Motivation

I added a new field in both the source entity type and the destination entity type, then set the corresponding inheritance from one field to the other using the "fallback" strategy.

I populated the new field on some source entities, hoping to see those values reflected in the destination entities, but it is not working. The destination entities are not getting the values that I'm expecting from the source.

It only starts to work when I go to the edit form of the destination entity and save it. And maybe it's because the rebuild of the "field_inheritance" key/value collection happens in the form submit callback field_inheritance_entity_form_submit().

I'm using the Recurring Events β†’ module and I configured the inheritance from a field in the Event Series to another in the Event Instance. You can imagine that we cannot manually go to all the edit forms of the Event Instances and save them in order to trigger that submit callback. There could be hundreds of Event Instances per each Series.

This is only occurring for entities that already existed at the time of creating and configuring the new fields and inheritance. Those new source entities and destination entities created after those changes, do not have the problem.

Steps to reproduce

  1. Create a new field in a bundle of any entity type
  2. Create a new field, of the same type as the one created in the previous step, in another bundle of any entity type
  3. Configure a field inheritance from one field to the other, using the "fallback" strategy
  4. Edit an existing entity of the source entity type and bundle and populate the new field with some valid value

Expected result: the value you populated in the source entity is reflected in the destination entity
Current result: the value you populated in the source entity is not being reflected in the destination entity, until you manually save the destination entity edit form.

Proposed resolution

If this has to do with the "field_inheritance" array stored in a key/value collection, then determine the correct scenarios where it has to be rebuilt.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡΄Colombia camilo.escobar

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

Comments & Activities

Production build 0.69.0 2024