Пример #1
0
 /**
  * Constructs the object.
  *
  * @param string $message The Message
  * @param string $formName The form name
  * @return null
  */
 public function __construct($message, $formName)
 {
     $this->formName = $formName;
     parent::__construct($message);
 }
Пример #2
0
 /**
  * Add a message.
  * Message can be generic message (e.g. success message),
  * global error message, form error, or field error. 
  *
  * @param spriebsch\MVC\Message\Error $error The error message
  * @return null
  */
 public function addMessage(\spriebsch\MVC\Message $message)
 {
     // Check for leaf classes first, since FieldError extends FormError.
     if ($message instanceof \spriebsch\MVC\Message\FieldError) {
         $this->fieldErrors[$message->getFormName()][$message->getFieldName()][] = $message;
         return;
     }
     if ($message instanceof \spriebsch\MVC\Message\FormError) {
         $this->formErrors[$message->getFormName()][] = $message;
         return;
     }
     if ($message instanceof \spriebsch\MVC\Message\Error) {
         $this->errors[] = $message;
         return;
     }
     $this->messages[] = $message;
 }