protected function processNotifierMapper(NotifierMapper $mapper)
 {
     $notifier = $mapper->getNotifier();
     try {
         $mapper->delete();
         $notifier->execute();
     } catch (Exception $ex) {
         Yii::getLogger()->log('An error ocurred while processing notifier [' . get_class($notifier) . '].' . PHP_EOL . 'Exception: [' . $ex->getTraceAsString() . ']', Logger::LEVEL_ERROR, 'notification');
     }
 }
 /**
  * Generates the Notifier object depending on the triggered event.
  * 
  * @param Event $event
  */
 public function execute($event)
 {
     if (!empty($this->classes[$event->name])) {
         if (is_callable($this->condition) && call_user_func($this->condition, $this->owner) === false) {
             return;
         }
         $class = $this->classes[$event->name];
         $notifier = new $class();
         if ($notifier instanceof Notifier === false) {
             throw new InvalidParamException('Class name [' . get_class($class) . '] provided in "classes" param must be an instance of \\jlorente\\notification\\models\\Notifier');
         }
         $notifier->setNotifierGenerator($this->owner);
         $mapper = new NotifierMapper();
         $mapper->setNotifier($notifier);
         if ($mapper->save() === false) {
             throw new Exception('Unable to save an instance of \\jlorente\\notification\\db\\NotifierMapper. Errors: [' . json_encode($mapper->getErrors()) . ']');
         }
     }
 }