mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
remove deprecation on PersonHasCenterValidator and fix tests
This commit is contained in:
@@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Validator\Constraints\Person;
|
||||
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
@@ -22,12 +22,12 @@ class PersonHasCenterValidator extends ConstraintValidator
|
||||
{
|
||||
private bool $centerRequired;
|
||||
|
||||
private CenterResolverDispatcherInterface $centerResolverDispatcher;
|
||||
private CenterResolverManagerInterface $centerResolverManager;
|
||||
|
||||
public function __construct(ParameterBagInterface $parameterBag, CenterResolverDispatcherInterface $centerResolverDispatcher)
|
||||
public function __construct(ParameterBagInterface $parameterBag, CenterResolverManagerInterface $centerResolverManager)
|
||||
{
|
||||
$this->centerRequired = $parameterBag->get('chill_person')['validation']['center_required'];
|
||||
$this->centerResolverDispatcher = $centerResolverDispatcher;
|
||||
$this->centerResolverManager = $centerResolverManager;
|
||||
}
|
||||
|
||||
public function validate($person, Constraint $constraint)
|
||||
@@ -40,7 +40,7 @@ class PersonHasCenterValidator extends ConstraintValidator
|
||||
return;
|
||||
}
|
||||
|
||||
if (null === $this->centerResolverDispatcher->resolveCenter($person)) {
|
||||
if ([] === $this->centerResolverManager->resolveCenters($person)) {
|
||||
$this
|
||||
->context
|
||||
->buildViolation($constraint->message)
|
||||
|
Reference in New Issue
Block a user