Use a pre-save hook for updating the talk date

This commit is contained in:
Oliver Davies 2020-05-26 12:00:35 +01:00
parent 2632f09b7f
commit f5767f7739

View file

@ -18,12 +18,11 @@ final class UpdateTalkCreatedDateOnSave implements EventSubscriberInterface {
public static function getSubscribedEvents() {
return [
HookEventDispatcherInterface::ENTITY_INSERT => 'entityInsertOrUpdate',
HookEventDispatcherInterface::ENTITY_UPDATE => 'entityInsertOrUpdate',
HookEventDispatcherInterface::ENTITY_PRE_SAVE => 'onEntityPreSave',
];
}
public function entityInsertOrUpdate(BaseEntityEvent $event): void {
public function onEntityPreSave(BaseEntityEvent $event): void {
if ($event->getEntity()->getEntityTypeId() != 'node') {
return;
}