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:
@@ -29,6 +29,7 @@ use Chill\MainBundle\Form\Type\AddressType;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
/**
|
||||
* Class PersonAddressController
|
||||
@@ -40,7 +41,21 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
class PersonAddressController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ValidatorInterface
|
||||
*/
|
||||
protected $validator;
|
||||
|
||||
/**
|
||||
* PersonAddressController constructor.
|
||||
*
|
||||
* @param ValidatorInterface $validator
|
||||
*/
|
||||
public function __construct(ValidatorInterface $validator)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
public function listAction($person_id)
|
||||
{
|
||||
$person = $this->getDoctrine()->getManager()
|
||||
@@ -302,9 +317,9 @@ class PersonAddressController extends AbstractController
|
||||
*/
|
||||
private function validatePerson(Person $person)
|
||||
{
|
||||
$errors = $this->get('validator')
|
||||
$errors = $this->validator
|
||||
->validate($person, null, array('Default'));
|
||||
$errors_addresses_consistent = $this->get('validator')
|
||||
$errors_addresses_consistent = $this->validator
|
||||
->validate($person, null, array('addresses_consistent'));
|
||||
|
||||
foreach($errors_addresses_consistent as $error) {
|
||||
|
Reference in New Issue
Block a user