/** * Validate vehicle data if @ValidateVehicle is used * * @param type $controller * @param type $methodName */ public function beforeController($controller, $methodName) { if ($this->reflector->hasAnnotation($this->annotation)) { $this->validate(); if ($this->validator->fails()) { throw new ValidationException($this->validator); } } }
/** * @param \OCA\Fuel\Validation\IValidator $validator */ public function __construct(IValidator $validator) { parent::__construct(["errors" => $validator->getErrors()], Http::STATUS_UNPROCESSABLE_ENTITY); }