Extract a common DataContainerInterface for lists and complex data

Created on 4 October 2014, about 10 years ago
Updated 6 June 2024, 7 months ago

Motivation

- Typed has the concept of lists and complex data, however there is general notion of general "data containers". That makes navigating in a tree of typed data unnecessarily complex as there is no fitting "data container" interface for the parent object of properties or list items.
- We have quite some methods that both interfaces (List + Complex data) share, e.g. get(), set(), isEmpty() - having this in a common container interface allows us to easily make use of those when working with data parent objects (e.g. the result of getParent()).
- Meanwhile, there is a TraversableTypedDataInterface which was aided as band-aid but fails to deliver the semantic meaning or
- When mapping data structures to typed data which neither are a fit for list interface or complex data interface, it's possible to stick to DataContainerInterface then. This is the case for sequences of config schema and therefore would help solving https://www.drupal.org/node/1928868 .

Proposed resolution

Extract a common interface: DataContainerInterface. According to wikipedia, a container can either be a list or complex data.

As complex data and lists use different terminology for their contained data it probably makes sense to keep shared methods overridden in those interface for better documentation.

Then, as there no use left for TraversableTypedDataInterface we should deprecate that in favour of DataContainerInterface.

Remaining tasks

Do it.

User interface changes

-

API changes

None - we could decide to add some type-hint to DataContainerInterface somewhere if we want to though.

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Typed data 

Last updated 16 days ago

  • Maintained by
  • 🇦🇹Austria @fago
Created by

🇦🇹Austria fago Vienna

Live updates comments and jobs are added and updated live.
  • Triaged core major

    There is consensus among core maintainers that this is a major issue. Only core committers should add this tag.

Sign in to follow issues

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