This should be a method on EntityManager / EntityManagerInterface
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | interdiff.txt | 769 bytes | swentel |
| #20 | 2319171-invokeBundleHook-20.patch | 10.38 KB | swentel |
| #18 | 2319171-invokeBundleHook-18.patch | 9.63 KB | swentel |
| #13 | 2319171-invokeBundleHook-13.patch | 10.68 KB | andypost |
| #13 | interdiff.txt | 4.03 KB | andypost |
Comments
Comment #1
andypostWhile renaming I found that
BlockContentTypeexecuted this hook twice ;)Comment #2
xanoWhat if we don't use the word hook in the method, so we can decide to extend this with Symfony event support later?
Comment #3
andypost@Xano makes sense, so any suggestions?
notifyBundleEventinvokeBundleComment #4
xanoI think event is good. It's a generic term that applies to both event hooks (as opposed to info hooks) and Symfony events.
Comment #5
yched commented"Event" is misleading as long as this is still hook-based, IMO.
Why not EM::onBundleCreate(), onBundleRename(), onBundleDelete(), like we do in other places ?
Comment #6
xanoIt is not misleading. Hooks are our technical solution for interacting with modules, whether for events or for gathering metadata (info hooks). We're still talking about CRUD events here, and the way the interaction takes place is secondary to that.
On the other hand, using an
onprefix would work too.Comment #7
andypost@yched do you mean to split this into 3 methods?
This could be
onBundleOperation()single methodComment #8
yched commentedI think splitting in separate methods would make sense, yes, esp. since the arguments are not the same for all ops ?
$op functions are a D5 thing :-p (ok, D6)
Comment #9
fago#1498720: [meta] Make the entity storage system handle changes in the entity and field schema definitions goes with methods named like
onFieldStorageDefinitionCreate(). We should make sure our naming pattern is consistent here. But, should the naming reflect that this is not just a regular event listeners but actually omitts the event as well? HavingonFieldStorageDefinitionCreate()as method name for the method that calls other on* seems confusing, so a name-separation seems to make sense.Then, maybe
handleFoo()would be a good name for actually reacting + omitting the event/hook?Agreed - it would be strange to have no event then. I'd be fine with adding an event in addition to the hook foo. If we can agree on that + open a follow-up to do it we could go with the new naming already.
-> invokeFooEvent() or dispatchFooEvent() ?
Comment #10
andypostHere's a split
Comment #11
effulgentsia commentedI don't understand the concern here. I don't see any problem in EM::onFoo() calling ES::onFoo(). In other words, I like what's in #10. In fact, I'm tempted to say that all code outside of the entity manager that calls $storage->on*() should call $manager->on*() instead, and let EM always delegate those kinds of reactions to ES, but that's a separate issue.
Can we use
$this->entityManager()here instead?How about changing this to
if ($storage instanceof FieldableEntityStorageInterface)?Comment referring to wrong hook name.
Comment #12
berdirI'm wondering if this is called twice now in many cases because config entities are explicitly deleted as well? Not sure if that happens before or after...
Comment #13
andypostChasing HEAD
Q: placed code for "base_field_override" into EM, probably better to move to hook
entity_entity_bundle_rename()where entity displays are updated#11
1) no, because the method is static
2) nice idea, fixed
3) fixed
#12 that was added in #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed so patch to try to remove
Comment #15
andypostonce again - removal of
entity_module_preuninstall()Comment #16
andypost@Berdir there could be a reason for the hook - entity test does not have config entity to define its bundles... but this code looks fragile
EDIT The only case I have in mind - bundles' entities are provided by other module then deinstalled enity type
Comment #17
andypostshould wait for #2031717: Make entity module not required and needs revert to #13
Comment #18
swentel commentedrerolled
Comment #20
swentel commentedComment #21
berdirThis is consistent with onEntityTypeCreate() and so on that we have no, looks good to me.
The function is new in 8.x and already has a change record, we can just update https://www.drupal.org/node/1964766 when it is committed.
We should also add a note about ConfigEntityBundleBase while we update it, saying that when using that, this is handled automatically for this.
Comment #22
alexpottCommitted 9617c20 and pushed to 8.0.x. Thanks!
Time to update https://www.drupal.org/node/1964766
Comment #24
andypostPlease review a changes https://www.drupal.org/node/1964766/revisions/view/2640104/7611839
Comment #25
swentel commentedlooks good to me