- Issue created by @plopesc
- 🇪🇸Spain plopesc Valladolid
Postponing on 📌 Store relation with the parent entity in the database instead of the State API Active for now. But this is still open to discussion.
As described in 🐛 Creating a new inheritance doesn't get added to existing children Active , when new Field Inheritance relationships are created, it is necessary to modify all the entities that want to make use of those relationships.
That's because the way how he relationships are stored in the database are 1:1 between the parent and the child entity for each relationship.
Given that many times the user end up having many relationships between the same entities, the aim of this iossue is to propose a new way to define those relationships entity based.
Before:
fields:
relationship_x:
skip: false
entity: a
relationship_y:
skip: true
entity: a
relationship_z:
skip: false
entity: a
.....
After:
entity:
'entity_type:bundle': a
In this way, any new relationship created that maps to the entity_type: bundle combination is assigned directly to entity a. Hence is not necessary to edit and explicitly assign that relationship.
However, this configuration might be overkill and would not give support for different scenarios where some of the relationships are ignored, or simply not all of them reference to the same entity
In order to give more granularity and avoid possible conflicts, the new storage approach would looks like this to allow to override defaults in case where different entities of the same bundle could be considered as parents:
entity:
'entity_type:bundle': a
fields:
relationship_x:
skip: false
entity: b
relationship_y:
skip: true
entity: b
Then any reference to the entity_type:bundle combination would be assigned to a, except the relationship_x, which will take into account the entity b. Also relationship_y would be skipped.
Implement a more generic and flexible storage system.
Finish the definition and implement it.
Widget might require to be updated to support the new logic.
Storage structure would be affected.
Storage structure would be affected.
Active
3.0
Code
Postponing on 📌 Store relation with the parent entity in the database instead of the State API Active for now. But this is still open to discussion.