Created
March 21, 2018 12:33
-
-
Save glye/5cefe0e3036ebc09210262be123b5f31 to your computer and use it in GitHub Desktop.
Hack for detailed field errors in exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/eZ/Publish/Core/Base/Exceptions/ContentFieldValidationException.php b/eZ/Publish/Core/Base/Exceptions/ContentFieldValidationException.php | |
index 913462637..f01bc370a 100644 | |
--- a/eZ/Publish/Core/Base/Exceptions/ContentFieldValidationException.php | |
+++ b/eZ/Publish/Core/Base/Exceptions/ContentFieldValidationException.php | |
@@ -38,7 +38,13 @@ class ContentFieldValidationException extends APIContentFieldValidationException | |
public function __construct(array $errors) | |
{ | |
$this->errors = $errors; | |
- parent::__construct('Content fields did not validate'); | |
+$str = ''; | |
+foreach($this->getFieldErrors() as $fieldError) { | |
+ $str .= "\n" . str_replace('%index%', | |
+ $fieldError['eng-GB'][0]->getTranslatableMessage()->values['index'], | |
+ $fieldError['eng-GB'][0]->getTranslatableMessage()->message); | |
+} | |
+ parent::__construct('Content fields did not validate' . $str); | |
} | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment