示例#1
0
 /**
  * Process events with handlers
  *
  * @param NotificationEvent $event
  * @return NotificationEvent
  */
 public function process(NotificationEvent $event)
 {
     $entity = $event->getEntity();
     // select rules by entity name and event name
     $notificationRules = $this->getRulesByCriteria(ClassUtils::getClass($entity), $event->getName());
     if (!$notificationRules->isEmpty()) {
         /** @var EventHandlerInterface $handler */
         foreach ($this->handlers as $handler) {
             $handler->handle($event, $notificationRules);
             if ($event->isPropagationStopped()) {
                 break;
             }
         }
     }
     return $event;
 }