File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 1010 */
1111final class ErrorDetailsTransformer implements TransformerInterface
1212{
13+ /**
14+ * @var string
15+ */
16+ private $ detailsName ;
17+
18+ /**
19+ * The constructor.
20+ *
21+ * @param string $detailsName The name of the details index.
22+ */
23+ public function __construct (string $ detailsName = 'details ' )
24+ {
25+ $ this ->detailsName = $ detailsName ;
26+ }
27+
1328 /**
1429 * Transform the given ValidationResult into an array.
1530 *
@@ -33,7 +48,7 @@ public function transform(ValidationResult $validationResult): array
3348
3449 $ errors = $ validationResult ->getErrors ();
3550 if ($ errors ) {
36- $ error [' details ' ] = $ this ->getErrorDetails ($ errors );
51+ $ error [$ this -> detailsName ] = $ this ->getErrorDetails ($ errors );
3752 }
3853
3954 return ['error ' => $ error ];
You can’t perform that action at this time.
0 commit comments