Problem/Motivation
The subscriptions field on the Subscriber entity type is currently added by config because it was required in earlier versions of Drupal 8. Now it just breaks consistency and is a bit confusing.
Proposed resolution
Define the field in Subscriber::baseFieldDefinitions() rather than as install config.
Comments
Comment #1
berdirYes, I think we should do this.
Miro had a lot of craz... interesting (;)) ideas, about making subscriber a standalone concept, and simplenews would just it. I have no idea how you would want to do that, but possibly bundles? In that case, subscriber would have to be a configurable or at least per-bundle field for the simplenews subscriber bundle....
But as I said, I don't really know how that would work, so let's do this :)
Comment #2
berdirComment #3
sasanikolic commentedComment #5
sasanikolic commentedChanges made in the core made the tests fail. Should be fixed now...
Comment #7
berdirI extracted the unrelated test fixes from this issue and committed them. The remaining test fails are caused by the change here, I don't know why yet.
Comment #9
LKS90 commentedApplied the patch to a fresh branch, made a patch from that, retesting
Comment #11
berdirI had a look at this, the problem is that this breaks views integration. Views doesn't generate the views data for base fields with cardinality > 1 that require a dedicated table.
That won't be easy to fix, as the API for field tables is specific to field config entities, not the more generic field (storage) definition interfaces. And EntityViewsData just looks at the defined tables and their columns.
Will ask @dawehner, but I'm considering to postpone this to a later release, it's not worth spending time on right now I think. Writing an upgrade path should't be that hard, as the storage doesn't actually change, we just need to delete the field configs.
Comment #12
adamps commentedComment #13
adamps commentedComment #15
adamps commentedComment #17
adamps commentedComment #18
adamps commentedComment #19
berdirsure that there are not reported entity field mismatches after the update?
And what about the views configuration, doesn't that need an update path?
And also views config dependencies, e.g. in form/view displays of subscribers? Sites will have trouble exporting/importing their configuration if you don't clean that up.
Comment #20
adamps commentedAha yes there are. Shouldn't be too hard.
So it could be any view of subscribers; and any entity form/view display. I have no idea how to start on that! Any ideas?
#11
Famous last words??
Comment #21
jonathanshaw# 11
Appears to be fixed by #2846614: Incorrect field name is used in views integration for multi-value base fields
The upgrade path from #2846614: Incorrect field name is used in views integration for multi-value base fields might give ideas. As well as terrify.
Comment #22
adamps commentedI think that we need to be practical for this module - this is not core and we have not released a stable release. This and other issues will need to change some of the schema, fields, etc, and that's why we made a 2.x.
Here is my proposal:
Thoughts?? @Berdir OK with you?
Comment #23
berdirSounds ok, one thing that might be worth checking is commerce, I know they have a similar issue where they do exactly the same, switch a configurable field to a base field, might have some useful things there.
> Writing an upgrade path shouldn't be that hard
Yeah, that was un unfortuate thing to say, was also a very long time ago ;)
the thing that I find a bit weird actually is why this even changes? The storage should be identical between a multi-value base field and a configurable field, so it might "just" be exposed differently to views. It might be easier to keep the structure in views the same than having to reconfigure it in an update function.
Comment #24
adamps commentedThanks @Berdir
Ah good idea, I found #3002939: Convert order/product multivalue configurable fields back into base fields. That issue even refers back to this issue and quotes Berdir saying "it shouldn't be that hard"!!! :-)
However I'm not sure about starting the work to try and auto-migrate views as I think some of the other issues might make more drastic changes that could not be auto-migrated. I propose to defer views migration until later when the overall picture is clearer #3059184: View migration for 8.x-1.x to 8.x-2.x. It will be a blocker for a 2.x beta.
Do you have something in mind? In both the old code and the new code, it was core Views code that chose the structure. The Commerce patch also seems to have made the exact same change that we have here. It feels like it will be difficult/risky to try and fight the way Views works and might create problems for the future.
Comment #25
adamps commentedComment #26
adamps commentedComment #27
adamps commented