Problem/Motivation
Note: This is both a bug ("Computed bundlie fields are broken") and a feature request ("Introduce the notion of computed field storage definitions") so landing on "task" as a compromise.
Because every field definition - including bundle fields - require an accompanying field storage definition, you also need to provide a field storage definition for computed bundle fields even though a computed (bundle) field does not require any storage. Because field storage definitions do not have the notion of "computed", this means that schema tables or columns will be created for those computed fields.
This can be worked around by marking the field storage definitions as having "custom storage", but that is a different semantic and is really just a workaround.
Proposed resolution
This is postponed on #2935932: Add a FieldDefinition class for defining bundle fields in code..
Introduce the notion of "computed" to field storage definitions.
Comments
Comment #2
tstoecklerComment #3
jibranMight be a duplicate of #2986634: Discuss the role of field storage definitions for computed fields.
Comment #4
geek-merlinThanks for linking the other issue. I'd prefer this as it has a workable proposal.
Comment #5
geek-merlinTo make my assumptions explicit and avoid misconcepts:
* a) A computed field may or may not use sql storage. Having a computed field in DB to ease queries has valid use cases.
* b) A computed field may or may not use custom storage. Currently a field that wants field custom storage has to declare as computed and save in the (pre|post)save method. This has relevant use cases but should get better DX.
Comment #6
plachParent issue fixed.
Comment #7
wim leers🎉
Comment #8
jibranMaybe another duplicate #2932273: Figure out how to implement configurable computed fields
Comment #9
jibran#2981047-32: Allow adding computed bundle fields in Views is kind of doing this.
Comment #10
jibran