Why are Drupal Entity Events not firing?

namespace Drupalta3mal_utilitiesEventSubscriber;

use SymfonyComponentEventDispatcherEventSubscriberInterface;
use DrupalCoreEntityEntityTypeEvents;
use DrupalCoreEntityEntityTypeEvent;

class EntityEvents implements EventSubscriberInterface {


    public function onCreate(EntityTypeEvent $event) {
        //Do things on creation
    }

    public function onUpdate(EntityTypeEvent $event) {
        dd('on update now');
    }

    public function onDelete(EntityTypeEvent $event) {
        //Do things on delete
    }

    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents() {
        $events = [];

        $events[EntityTypeEvents::CREATE][] = ['onCreate', 1];
        $events[EntityTypeEvents::UPDATE][] = ['onUpdate', 1];
        $events[EntityTypeEvents::DELETE][] = ['onDelete', 1];
        return $events;
    }

}

I have included this in the services file as well, the getSubscribedEvents is called but it doe not reach the updated one, any help ?
Thank you.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *