#111226Resolve relations of FlexForm sheet fields in FlexFormSchemaFactory
Description
FlexFormSchemaFactory turns the fields of a resolved FlexForm data structure into Schema API field types. Several things make the result unusable for code that works on database rows, such as the DataHandler:
- The only entry point, getSchemaForRecord(), requires a RawRecord. DataHandler and most other consumers have plain rows.
- Relational sheet fields (group, select with foreign_table, inline,
file, category) have no relations: the only caller passes an empty
RelationMap, so getRelations() returns nothing and
ActiveRelation::isManyToMany() / manyToManyTable() / toField()
cannot be used. With a populated map, every sheet field would
receive the relations of all fields of the same flex column, as
the lookup is not scoped to the field. - A sheet field of an unknown type throws FieldTypeNotAvailableException, so the whole schema cannot be built.
- Only some data structure exceptions are caught, so an InvalidDataStructureException escapes, while DataHandler catches AbstractInvalidDataStructureException.
Solution:
- Add getSchemaForRow(string $tableName, FlexFormFieldType $field, array $row); getSchemaForRecord() delegates to it.
- Build the relations of each sheet field from its own configuration. Nothing can point to a field within a data structure, so no global RelationMap is needed; the RelationMap argument of getSchemaForRecord() becomes optional and is no longer evaluated.
- Skip sheet fields of unavailable types.
- Return null for every AbstractInvalidDataStructureException.
This is the groundwork for using Schema API field objects instead of raw data structure arrays for FlexForm fields in the DataHandler.
Reviews 4
History 12
-
Gerrit Code Review pushed patch set 1 for main to change 97104 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-24T11:34:49+00:00" > 10/24/26, 11:34 </span> -
Benni Mack commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-10-25T01:35:13+00:00" > 10/25/26, 01:35 </span>
Applied in changeset commit:3dae943cbb53eb7957aac87b9fb9f8e52ba25b60.