Beispiel #1
0
 /**
  * send a message to the notification-handler
  * @param $message
  * @param string $namespace
  * @return $this
  */
 public function addMessage($message, $namespace = self::NAMESPACE_INFO)
 {
     if (!$message instanceof NotificationEntityInterface) {
         $messageText = $this->isTranslatorEnabled() ? $this->getTranslator()->translate($message, $this->getTranslatorTextDomain()) : $message;
         $message = new NotificationEntity();
         $message->setNotification($messageText);
         $message->setPriority($this->namespace2priority[$namespace]);
     }
     $nEvent = new NotificationEvent();
     $nEvent->setNotification($message);
     $this->notificationListener->trigger(NotificationEvent::EVENT_NOTIFICATION_ADD, $nEvent);
     return $this;
 }