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 Symfony\Component\Security\Core\Role\Role;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use Chill\PersonBundle\Search\SimilarPersonMatcher;
|
use Chill\PersonBundle\Search\SimilarPersonMatcher;
|
||||||
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class PersonController extends Controller
|
class PersonController extends Controller
|
||||||
{
|
{
|
||||||
@ -39,10 +40,19 @@ class PersonController extends Controller
|
|||||||
* @var SimilarPersonMatcher
|
* @var SimilarPersonMatcher
|
||||||
*/
|
*/
|
||||||
protected $similarPersonMatcher;
|
protected $similarPersonMatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var TranslatorInterface
|
||||||
|
*/
|
||||||
|
protected $translator;
|
||||||
|
|
||||||
public function __construct(SimilarPersonMatcher $similarPersonMatcher)
|
public function __construct(
|
||||||
{
|
SimilarPersonMatcher $similarPersonMatcher,
|
||||||
|
TranslatorInterface $translator
|
||||||
|
) {
|
||||||
$this->similarPersonMatcher = $similarPersonMatcher;
|
$this->similarPersonMatcher = $similarPersonMatcher;
|
||||||
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCFGroup()
|
public function getCFGroup()
|
||||||
@ -119,8 +129,8 @@ class PersonController extends Controller
|
|||||||
|
|
||||||
if ( ! $form->isValid() ) {
|
if ( ! $form->isValid() ) {
|
||||||
$this->get('session')
|
$this->get('session')
|
||||||
->getFlashBag()->add('error', 'The person data provided'
|
->getFlashBag()->add('error', $this->translator
|
||||||
. ' are not valid');
|
->trans('This form contains errors'));
|
||||||
|
|
||||||
return $this->render('ChillPersonBundle:Person:edit.html.twig',
|
return $this->render('ChillPersonBundle:Person:edit.html.twig',
|
||||||
array('person' => $person,
|
array('person' => $person,
|
||||||
|
@ -2,4 +2,5 @@ services:
|
|||||||
Chill\PersonBundle\Controller\PersonController:
|
Chill\PersonBundle\Controller\PersonController:
|
||||||
arguments:
|
arguments:
|
||||||
$similarPersonMatcher: '@Chill\PersonBundle\Search\SimilarPersonMatcher'
|
$similarPersonMatcher: '@Chill\PersonBundle\Search\SimilarPersonMatcher'
|
||||||
|
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user