- BC Break: _PHP_ namespaces changed (PSR-4 standard). The _root_ namespace for all _PF_ related scripts is Exodus4D\Pathfinder
- BC Break: Project folder structure changed. Removed `app/main` dir. - BC Break: Core _PHP_ framework + dependencies moved into `composer.json` and are no longer part of this repo
This commit is contained in:
46
app/Exception/ValidationException.php
Normal file
46
app/Exception/ValidationException.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: exodus4d
|
||||
* Date: 21.02.15
|
||||
* Time: 00:12
|
||||
*/
|
||||
|
||||
namespace Exodus4D\Pathfinder\Exception;
|
||||
|
||||
|
||||
class ValidationException extends PathfinderException {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $codes = [
|
||||
2000 => 422
|
||||
];
|
||||
|
||||
/**
|
||||
* table column that triggers the exception
|
||||
* @var string
|
||||
*/
|
||||
private $field;
|
||||
|
||||
/**
|
||||
* ValidationException constructor.
|
||||
* @param string $message
|
||||
* @param string $field
|
||||
*/
|
||||
public function __construct(string $message, string $field = ''){
|
||||
parent::__construct($message, 2000);
|
||||
$this->field = $field;
|
||||
}
|
||||
|
||||
/**
|
||||
* get error object
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function getError() : \stdClass {
|
||||
$error = parent::getError();
|
||||
$error->field = $this->field;
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user