mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
fix service dependency injection for validatorInterface
This commit is contained in:
@@ -32,6 +32,7 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
/**
|
||||
* Class AccompanyingPeriodController
|
||||
@@ -46,13 +47,20 @@ class AccompanyingPeriodController extends AbstractController
|
||||
protected $eventDispatcher;
|
||||
|
||||
/**
|
||||
* ReportController constructor.
|
||||
* @var ValidatorInterface
|
||||
*/
|
||||
protected $validator;
|
||||
|
||||
/**
|
||||
* AccompanyingPeriodController constructor.
|
||||
*
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
* @param ValidatorInterface $validator
|
||||
*/
|
||||
public function __construct(EventDispatcherInterface $eventDispatcher)
|
||||
public function __construct(EventDispatcherInterface $eventDispatcher, ValidatorInterface $validator)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,12 +293,14 @@ class AccompanyingPeriodController extends AbstractController
|
||||
* @param Person $person
|
||||
* @return \Symfony\Component\Validator\ConstraintViolationListInterface
|
||||
*/
|
||||
private function _validatePerson(Person $person) {
|
||||
$errors = $this->get('validator')->validate($person, null,
|
||||
private function _validatePerson(Person $person)
|
||||
{
|
||||
$errors = $this->validator->validate($person, null,
|
||||
array('Default'));
|
||||
$errors_accompanying_period = $this->get('validator')->validate($person, null,
|
||||
array('accompanying_period_consistent'));
|
||||
|
||||
$errors_accompanying_period = $this->validator->validate($person, null,
|
||||
array('accompanying_period_consistent'));
|
||||
|
||||
foreach($errors_accompanying_period as $error ) {
|
||||
$errors->add($error);
|
||||
}
|
||||
|
Reference in New Issue
Block a user