You are here

EntityEventPresaveSubscriber.php in Entity Events 2.0.x

File

src/EventSubscriber/EntityEventPresaveSubscriber.php
View source
<?php

namespace Drupal\entity_events\EventSubscriber;

use Drupal\entity_events\EntityEventType;
use Drupal\entity_events\Event\EntityEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * Event subscriber for entity presave event.
 */
abstract class EntityEventPresaveSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[EntityEventType::PRESAVE][] = [
      'onEntityPresave',
      800,
    ];
    return $events;
  }

  /**
   * Method called when Event occurs.
   *
   * @param \Drupal\entity_events\Event\EntityEvent $event
   *   The event.
   */
  public abstract function onEntityPresave(EntityEvent $event);

}

Classes

Namesort descending Description
EntityEventPresaveSubscriber Event subscriber for entity presave event.