@@ -248,7 +248,7 @@ public function postRegisterAction()
248
248
$ errors = $ validator ->validate ($ user );
249
249
250
250
if (count ($ errors ) > 0 ) {
251
- return $ this ->reportValidationErrors ($ request , $ errors );
251
+ return $ this ->reportValidationErrors ($ errors , $ request -> getLocale () );
252
252
}
253
253
254
254
// Everything ok, now write the user record
@@ -441,7 +441,7 @@ public function editProfileAction()
441
441
$ errors = $ validator ->validate ($ user , null , array ('profile_edit ' ));
442
442
443
443
if (count ($ errors ) > 0 ) {
444
- return $ this ->reportValidationErrors ($ request , $ errors );
444
+ return $ this ->reportValidationErrors ($ errors , $ request -> getLocale () );
445
445
}
446
446
447
447
// Everything ok, now update the user record
@@ -665,14 +665,14 @@ private function fetchAccessToken(Request $request, $grantType)
665
665
return $ response ['result ' ];
666
666
}
667
667
668
- private function reportValidationErrors (Request $ request , \Symfony \Component \Validator \ConstraintViolationList $ errors )
668
+ private function reportValidationErrors (\Symfony \Component \Validator \ConstraintViolationList $ errors, $ locale )
669
669
{
670
670
$ errorArray = [];
671
671
foreach ($ errors as $ error ) {
672
672
$ constraint = $ error ->getConstraint ();
673
673
$ errorItem = array (
674
674
"error_description " => $ error ->getPropertyPath ().': ' .$ error ->getMessage ().' ' .$ error ->getInvalidValue (),
675
- "show_message " => $ this ->get ('translator ' )->trans ($ constraint ->payload ['api_error ' ], array (), 'messages ' , $ request -> getLocale () )
675
+ "show_message " => $ this ->get ('translator ' )->trans ($ constraint ->payload ['api_error ' ], array (), 'messages ' , $ locale )
676
676
);
677
677
array_push ($ errorArray , $ errorItem );
678
678
$ this ->logMessage (400 , $ errorItem ['error_description ' ] );
0 commit comments