You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
644 B
PHTML
23 lines
644 B
PHTML
7 years ago
|
<?php
|
||
|
|
||
7 years ago
|
namespace BusinessLogic\Exceptions;
|
||
7 years ago
|
|
||
7 years ago
|
use BusinessLogic\ValidationModel;
|
||
7 years ago
|
use Exception;
|
||
|
|
||
7 years ago
|
class ValidationException extends Exception {
|
||
|
public $validationModel;
|
||
|
|
||
|
/**
|
||
|
* ValidationException constructor.
|
||
7 years ago
|
* @param ValidationModel $validationModel The validation model
|
||
7 years ago
|
* @throws Exception If the validationModel's errorKeys is empty
|
||
|
*/
|
||
|
function __construct($validationModel) {
|
||
|
if (count($validationModel->errorKeys) === 0) {
|
||
|
throw new Exception('Tried to throw a ValidationException, but the validation model was valid!');
|
||
|
}
|
||
|
|
||
|
$this->validationModel = $validationModel;
|
||
|
}
|
||
|
}
|