mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
fix service dependency injection for validatorInterface
This commit is contained in:
@@ -38,6 +38,7 @@ use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Chill\MainBundle\Search\SearchProvider;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
/**
|
||||
* Class PersonController
|
||||
@@ -80,6 +81,11 @@ class PersonController extends AbstractController
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
*/
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @var ValidatorInterface
|
||||
*/
|
||||
private $validator;
|
||||
|
||||
public function __construct(
|
||||
SimilarPersonMatcher $similarPersonMatcher,
|
||||
@@ -87,7 +93,8 @@ class PersonController extends AbstractController
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
PersonRepository $personRepository,
|
||||
ConfigPersonAltNamesHelper $configPersonAltNameHelper,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
ValidatorInterface $validator
|
||||
) {
|
||||
$this->similarPersonMatcher = $similarPersonMatcher;
|
||||
$this->translator = $translator;
|
||||
@@ -95,6 +102,7 @@ class PersonController extends AbstractController
|
||||
$this->configPersonAltNameHelper = $configPersonAltNameHelper;
|
||||
$this->personRepository = $personRepository;
|
||||
$this->logger = $logger;
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
public function getCFGroup()
|
||||
@@ -267,14 +275,14 @@ class PersonController extends AbstractController
|
||||
*/
|
||||
private function _validatePersonAndAccompanyingPeriod(Person $person)
|
||||
{
|
||||
$errors = $this->get('validator')
|
||||
$errors = $this->validator
|
||||
->validate($person, null, array('creation'));
|
||||
|
||||
//validate accompanying periods
|
||||
$periods = $person->getAccompanyingPeriods();
|
||||
|
||||
foreach ($periods as $period) {
|
||||
$period_errors = $this->get('validator')
|
||||
$period_errors = $this->validator
|
||||
->validate($period);
|
||||
|
||||
//group errors :
|
||||
|
Reference in New Issue
Block a user