Closed (duplicate)
Project:
Drupal core
Version:
8.4.x-dev
Component:
entity system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Sep 2016 at 16:30 UTC
Updated:
14 Feb 2017 at 14:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tim.plunkettComment #3
claudiu.cristeaI think hook_entity_insert() still make sense. There are specific tasks that are applying only to entity insertion.
Comment #4
fago>I think hook_entity_insert() still make sense. There are specific tasks that are applying only to entity insertion.
Well for that postSave has the $update boolean. I'm +1 for adding postSave as it helps with consistency also, I'm not so sure about deprecating insert/update. Seems to be a too large change to do between to minor versions to me (for everyone who wants to be a good citizen and follow deprecations).
Comment #5
fagoNote: slightly related: #1729812: Separate storage operations from reactions
Comment #6
tim.plunkettJust had someone else hit this today. It continues to be very confusing.
Adding postsave is nice, but that won't solve the problem. Deprecating (and eventually removing) the hooks that don't do what you think is the fix here.
Comment #8
tim.plunkettThat is an extremely brittle test. I think I'll just deal with it here, but #2824165: Remove brittleness from ConfigEntityStorageTest would help if it happens first
Comment #9
berdirShould we include some conversions, to see how that looks?
The deprecation message isn't following the standard yet :)
Comment #10
berdirI guess the only argument against this is the long-term goal of removing hooks completely in favor of events? So adding new hooks is going a bit against that. Personally, I'm in no hurry to go there, though :)
Comment #11
tim.plunkettIn order to keep the "events for hooks" issue clean, I was hoping to keep it 1:1. Therefore to have the right events, we'd want to do this first.
Did a couple conversions and fixed the tests.
Comment #12
berdirthis doesn't work AFAIK, isNew() is already updated at this point and it is no longer new. That's why ::postSave() has an $update argument.
Comment #15
dpiThis issue is a dupe of #2221347: Add hook_entity_postsave hook. Although this issue has progress...
Comment #16
tim.plunkett