Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
entity system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Mar 2019 at 10:33 UTC
Updated:
10 Apr 2019 at 09:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
berdirAh, I see, we only did that for file entities in \Drupal\file\FileStorageSchema::getSharedTableFieldSchema().
Comment #3
berdirComment #4
amateescu commentedWe need to check whether the entity type uses core's default SQL storage class :)
Comment #5
berdirAdded the check and media example data, which makes the existing update path test fail.
To create that, I've switched to 8.4, imported the dumped data, created two media entities, manually set the uid for the first to NULL, then switched back to 8.8 and exported the data for all media and. I updated #2544972: Add options to limit tables, exclude data, or only export data to DbDumpCommand with a data-only option for that.
Comment #7
sam152 commentedFix and fixture looks good. The fail is unrelated, but once that's resolved we can get a green run.
My only query was, is there a difference between the owner of a media item being NULL and being owned by 0? For the purposes of access control, it seems like the prevailing logic is: anonymous users can't be the owners of anything:
The first truth-y check for $account->id() would prevent that. So +1 RTBC.
Comment #8
sam152 commentedComment #9
amateescu commentedAgreed with @Sam152, I think this looks ready to go! I retested the full patch from #5 and it didn't bump into the random fail again :)
Comment #10
alexpottI think this is a great stopgap fix until something like #2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field lands. And it's nice to catch and fix update bugs before the beta! Great work everyone.
Committed and pushed 91dc88316b to 8.8.x and 289a17fc2c to 8.7.x. Thanks!
Comment #13
plach