mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add more generic message when invalid form during person update
This commit is contained in:
parent
081f4f9b4c
commit
2f7a8f1ebc
@ -31,6 +31,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\PersonBundle\Search\SimilarPersonMatcher;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
class PersonController extends Controller
|
||||
{
|
||||
@ -39,10 +40,19 @@ class PersonController extends Controller
|
||||
* @var SimilarPersonMatcher
|
||||
*/
|
||||
protected $similarPersonMatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(SimilarPersonMatcher $similarPersonMatcher)
|
||||
{
|
||||
public function __construct(
|
||||
SimilarPersonMatcher $similarPersonMatcher,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->similarPersonMatcher = $similarPersonMatcher;
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function getCFGroup()
|
||||
@ -119,8 +129,8 @@ class PersonController extends Controller
|
||||
|
||||
if ( ! $form->isValid() ) {
|
||||
$this->get('session')
|
||||
->getFlashBag()->add('error', 'The person data provided'
|
||||
. ' are not valid');
|
||||
->getFlashBag()->add('error', $this->translator
|
||||
->trans('This form contains errors'));
|
||||
|
||||
return $this->render('ChillPersonBundle:Person:edit.html.twig',
|
||||
array('person' => $person,
|
||||
|
@ -2,4 +2,5 @@ services:
|
||||
Chill\PersonBundle\Controller\PersonController:
|
||||
arguments:
|
||||
$similarPersonMatcher: '@Chill\PersonBundle\Search\SimilarPersonMatcher'
|
||||
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||
tags: ['controller.service_arguments']
|
||||
|
Loading…
x
Reference in New Issue
Block a user