Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 296042

Allow field types to control how properties are mapped to and from storage

$
0
0

Updated: Comment #41

Problem/Motivation

- Mapping field item properties to DB storage record is hardcoded in \Drupal\Core\Entity\Sql\SqlContentEntityStorage.
- It contains special cases for the serialize key of FieldItemInterface::schema, and a special case of this special case for MapItem field (where not a single property but all properties are serialized).
- Issues like #2563843: MapItem is broken for configurable fields demand to add more special cases
- In the context of the JSON storage initiatives (like #3276818: [META] Add support for JSON field queries in entity queries), a proper JSON map field adds more requirements to that.

Time to add an API so that fields can specify how their properties are mapped to their schema columns.

Proposed resolution

- Allow field type classes to define how their values should be (un)serialized.
- Remove the serialize key from MapItem's schema and use this mechanism instead.
- Deprecate the serialize key in a followup.

Remaining tasks

- Decide on how this API should work, code, review, commit.

User interface changes

None.

API changes

Addition: Field items can specify how they are mapped to storage and possibly serialized or JSON encoded.


Viewing all articles
Browse latest Browse all 296042

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>