| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* @copyright © Melograno Venture Studio. All rights reserved. |
| 5 |
* @licence See LICENCE.md for license details. |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace IvyForms\Common\Exceptions; |
| 9 |
|
| 10 |
/** |
| 11 |
* Validation failure scoped to one or more form field keys (e.g. file-upload_0). |
| 12 |
*/ |
| 13 |
class FieldValidationException extends ValidationException |
| 14 |
{ |
| 15 |
/** |
| 16 |
* @param string $message Human-readable validation message. |
| 17 |
* @param array<string, array{code: string}> $submissionFieldErrors Map of field key => error metadata. |
| 18 |
*/ |
| 19 |
public function __construct(string $message, array $submissionFieldErrors) |
| 20 |
{ |
| 21 |
parent::__construct($message, 0, null, $submissionFieldErrors); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* @return array<string, array{code: string}> |
| 26 |
*/ |
| 27 |
public function getSubmissionFieldErrors(): array |
| 28 |
{ |
| 29 |
/** @var array<string, array{code: string}> */ |
| 30 |
return $this->getFieldErrors(); |
| 31 |
} |
| 32 |
} |
| 33 |
|