public function notifyListener(Event $event)
 {
     foreach ($this->eventListener as $listener) {
         $event->setEventMessage($event->getEventMessage() . "<br>");
         echo $event->getEventMessage();
         $listener->processEvent($event);
     }
 }
 public function processEvent(Event $event)
 {
     // just store all incoming events inside the event list in allocated array.
     $this->eventList[$event->getEventType()][] = $event;
 }
Exemple #3
0
 /**
  * This method returns all objects produced by given query of type $classname.
  *
  * @param string $query
  *            the sql statement
  * @param string $className
  *            name of the type that we expect
  * @return multitype:|boolean
  */
 public function fetchAllShortURLs($query, $className)
 {
     $con = $this->getConnection();
     if (isset($con)) {
         $stmt = $con->prepare($query);
         $stmt->execute();
         $result = $stmt->fetchObject($className);
         return $result;
     } else {
         $event = new Event(Event::ERROR);
         $event->setEventMessage("Error Code: " . $stmt->errorCode() . " | " . $stmt->errorInfo());
         $this->eventManager->notifyListener($event);
         return false;
     }
 }