EntityOperationEvent.php in Hook Event Dispatcher 8.2
File
modules/core_event_dispatcher/src/Event/Entity/EntityOperationEvent.php
View source
<?php
namespace Drupal\core_event_dispatcher\Event\Entity;
use Drupal\Core\Entity\EntityInterface;
use Drupal\hook_event_dispatcher\Event\EventInterface;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Symfony\Component\EventDispatcher\Event;
class EntityOperationEvent extends Event implements EventInterface {
private $operations = [];
private $entity;
public function __construct(EntityInterface $entity) {
$this->entity = $entity;
}
public function getEntity() : EntityInterface {
return $this->entity;
}
public function getOperations() : array {
return $this->operations;
}
public function setOperations(array $operations) : void {
$this->operations = $operations;
}
public function addOperation(string $name, array $operation) : void {
$this->operations[$name] = $operation;
}
public function getDispatcherType() : string {
return HookEventDispatcherInterface::ENTITY_OPERATION;
}
}