Closed (fixed)
Project:
Drupal core
Version:
9.0.x-dev
Component:
entity system
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Dec 2019 at 16:32 UTC
Updated:
9 Mar 2020 at 13:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
amateescu commentedLet's give it a try.
Comment #4
hchonovI think, that we should completely unset it from the serialized object instead of setting to NULL which is different.
----
Removing all the BC layers from the Entity API is already being taken care of in #3069696: Remove BC layers from the entity system and the patch there has far less failures. However it lacks an update like in the patch here for removing the BC layer property from the installed definitions. I would propose closing this issue as a duplicate and adding the update to the patch there.
Comment #5
amateescu commentedI think this issue is hard enough to be done on its own, independently of the larger #3069696: Remove BC layers from the entity system.
Comment #7
amateescu commentedMissed a few spots. Not sending this one to the testbot because it will have the same failures as #5.
Comment #8
amateescu commentedLet's a try a patch combined with #3098427: Manipulating the revision metadata keys before running the BC layer breaks the BC layer and #3087644: Remove Drupal 8 updates up to and including 88**.
Comment #9
amateescu commentedFixed a few more things that were changed/added in #3098427: Manipulating the revision metadata keys before running the BC layer breaks the BC layer.
Comment #10
amateescu commentedThe combined patch needs to be rolled with
--binary.Comment #12
amateescu commentedMore cleanup after #3098427: Manipulating the revision metadata keys before running the BC layer breaks the BC layer.
Comment #14
catchBumping this to critical since it's becoming the 9.0.x fix for #3098427: Manipulating the revision metadata keys before running the BC layer breaks the BC layer. It also blocks #3069696: Remove BC layers from the entity system which in turn blocks other deprecation removals.
The patch in #12 looks encouraging. Does it have to be a hook_update_N() or if it's only removing cruft could it be a hook_post_update_NAME()?
Asking because the longer we can avoid having to deal with #3108658: Handling update path divergence between 11.x and 10.x the better.
Comment #15
catchNeeds a re-roll.
Comment #16
damienmckennaTagging as a requirement for Drupal 9.0-beta1.
Comment #17
berdirHere is a reroll against 9.0.x, including the stuff from #3098427: Manipulating the revision metadata keys before running the BC layer breaks the BC layer that is still needed. I also changed it to a post update. The fact that we are using post updates to update problems with update version numbers is an interesting fact considering that we're also thinking about switching back to numbers there to to make removing them again easier :)
Comment #19
berdirRemoving the expected deprecation messages as we no longer trigger them.
Note: A bit unfortunate that we're doing changes here against the untested workspaces_update_8003(), but we have an issue for that (#3108416: Remove workspace_update_8803()) and #3095333: Extend filled database dump with new stable modules and content for them already adds some test coverage to make sure that it at least doesn't fail in any way.
Comment #20
hchonovThe return $this is missing in the actual implementation of setRevisionMetadataKey().
I think this method isn't needed anymore?
This works and we can keep it, but it would've been simpler to define a closure which simply does unset($this->requiredRevisionMetadataKeys), instead of creating a new object.
Comment #21
hchonovWhat I mean is that this method offers default values for the revision metadata keys if they or some of them are not defined on the entity type.
This is however different than what we do in other similar traits. For example in - EntityOwnerTrait - there we first check whether the entity type has an "owner" entity key and only then return the base field for it.
Now that we remove the BC layer the revision metadata keys, they should be defined on the entity type. Therefore we should also remove the default values from the trait and instead only return revision metadata fields based on the revision metadata keys.
Comment #22
berdirThanks for the review.
1. Fixed.
2. Good point. I removed all usages of the method, deprecated it for D10 for the unlikely case that someone used it directly and added exceptions if you try to use it with an entity type without the necessary metadata keys.
3. I'm not sure how that would work, so I left it as-is.
Comment #23
berdirComment #24
hchonovThank you for the changes.
Why was this needed? Doesn't look like a practice of doing it in other traits providing entity fields.
P.S. I understand the idea of doing this, I am just not sure whether it is needed as entity traits are to be used inside entity classes, which always have this method. If this is a new standard for traits, then I am fine with it as it is more explicit anyway, but then we should be consistent and do that for all other traits (for sure in a different issue, if there isn't one already).
P.S.2. If we are about to keep it, then it should match the parent definition and therefore declare the visibility as public explicitly:
abstract public function getEntityType();.Comment #25
berdirIt's there for the return type that is different from the parent. Instead of inline @var in the old method.
Comment #26
hchonovOk, then let's just explicitly define the visibility modifier - public, in order to match the parent definition explicitly.
Comment #27
amateescu commentedFixed #26 and also removed a hunk from
workspaces.installwhich is not needed, because that upgrade function will be removed in 9.0.x by #3108416: Remove workspace_update_8803().All the reviews so far have been addressed, so I think this is ready for committers to take a look.
Comment #28
alexpottFeels very odd to be added this in 9.0.x and not in 8.9.x - ah I knew I was getting deja-vu - #3098427: Manipulating the revision metadata keys before running the BC layer breaks the BC layer adds this to 8.x
Is this tested anywhere?
Comment #29
amateescu commentedThanks for the review, @alexpott!
Turns out that the update function really needed test coverage :) I remember testing it manually at the time, but it's very likely that I didn't catch the problem exposed by this explicit test coverage.
Comment #31
berdirTest fail was unrelated.
Yay tests and yay @alexpott :)
Could we maybe use property_exists() to check the property instead of the array conversion? According to https://3v4l.org/ugoKX, that works since 5.3 on protected properties.
Also not sure with the @group legacy on the test. Right now we shouldn't need it, but sooner or later, we'll need to add it.
Comment #32
amateescu commentedI tried using
property_exists()but it didn't work in this case. I'm not sure what's so special about those entity type objects, but the array conversion was the only thing that worked reliably both in the update test and in the update function itself..As for the
@group legacy, I guess it can be removed on commit if the committer thinks the same way :)Comment #33
berdirRight, probably because we also remove the property, so it only exists as an dynamic property now, which property_exists() doesn't work with.
I guess this is as good as we can make it then.
Comment #35
catchCommitted 5500590 and pushed to 9.0.x. Thanks!