/**
  * Constructs a validation exception
  *
  * @param Errors $errors The validation errors
  */
 public function __construct(Errors $errors)
 {
     $this->errors = $errors;
     if (!$errors->hasErrors()) {
         parent::__construct('No errors');
     } else {
         parent::__construct($errors->toString());
     }
 }
예제 #2
0
 private function showResults()
 {
     if (Errors::hasErrors()) {
         $this->response['status'] = FALSE;
         $this->response['errors'] = Errors::getErrors();
         unset($this->response['results']);
     }
     echo json_encode($this->response);
     exit;
 }
예제 #3
0
<?php

if (Errors::hasErrors()) {
    ?>
    <div class="callout callout-danger">
        <?php 
    foreach (Errors::getErrors() as $error) {
        ?>
            <p class="small"> - <?php 
        echo $error;
        ?>
</p>
        <?php 
    }
    ?>
    </div>
<?php 
}