fix phpstan errors level 2

This commit is contained in:
Julie Lenaerts 2024-04-23 20:52:22 +02:00
parent ed3e0f889e
commit dcc285e976
21 changed files with 50 additions and 67 deletions

View File

@ -1,5 +1,5 @@
parameters: parameters:
level: 5 level: 2
paths: paths:
- src/ - src/
- utils/ - utils/

View File

@ -71,7 +71,7 @@ class ApiWrapper
$data = \json_decode((string) $response->getBody()); $data = \json_decode((string) $response->getBody());
// set the key with an expiry time // set the key with an expiry time
$this->redis->setEx( $this->redis->setex(
$cacheKey, $cacheKey,
$data->expires_in - 2, $data->expires_in - 2,
\serialize($data) \serialize($data)

View File

@ -67,7 +67,7 @@ trait ProcessRequestTrait
&& count($e->getResponse()->getHeader('Retry-After')) > 0) { && count($e->getResponse()->getHeader('Retry-After')) > 0) {
if ($counter > 5) { if ($counter > 5) {
$logger->error('too much 429 response', [ $logger->error('too much 429 response', [
'request' => Psr7\str($e->getRequest()), 'request' => Psr7\get($e->getRequest()),
]); ]);
throw $e; throw $e;

View File

@ -22,8 +22,6 @@ use Symfony\Component\HttpFoundation\Response;
*/ */
class CSCrudReportController extends EntityPersonCRUDController class CSCrudReportController extends EntityPersonCRUDController
{ {
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
protected function onBeforeRedirectAfterSubmission(string $action, $entity, FormInterface $form, Request $request): ?Response protected function onBeforeRedirectAfterSubmission(string $action, $entity, FormInterface $form, Request $request): ?Response
{ {
$next = $request->request->get('submit', 'save-and-close'); $next = $request->request->get('submit', 'save-and-close');

View File

@ -102,7 +102,7 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
}; };
} }
protected function getTemplateFor($action, $entity, Request $request) protected function getTemplateFor($action, $entity, Request $request): string
{ {
switch ($action) { switch ($action) {
case 'ps_situation_edit': case 'ps_situation_edit':
@ -114,7 +114,7 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
case 'dispositifs_view': case 'dispositifs_view':
return '@ChillJob/CSPerson/dispositifs_view.html.twig'; return '@ChillJob/CSPerson/dispositifs_view.html.twig';
default: default:
parent::getTemplateFor($action, $entity, $request); return parent::getTemplateFor($action, $entity, $request);
} }
} }

View File

@ -67,7 +67,7 @@ class CSReportController extends AbstractController
}; };
$results[$key] = $this->managerRegistry->getManager() $results[$key] = $this->managerRegistry->getManager()
->getRepository($className) ->getRepository($className)
->findByPerson($person, $ordering); ->findBy(['person' => $person], $ordering);
} }
return $results; return $results;

View File

@ -544,7 +544,6 @@ class CSPerson
/** /**
* Get niveauMaitriseLangue. * Get niveauMaitriseLangue.
* *
* @return json
*/ */
public function getNiveauMaitriseLangue() public function getNiveauMaitriseLangue()
{ {
@ -562,7 +561,7 @@ class CSPerson
return; return;
} }
if (\in_array('aucun', $this->getNiveauMaitriseLangue())) { if (\in_array('aucun', $this->getNiveauMaitriseLangue(), true)) {
if (count($this->getNiveauMaitriseLangue()) > 1) { if (count($this->getNiveauMaitriseLangue()) > 1) {
$context->buildViolation("Si \"Aucun\" est choisi dans la liste, il n'est " $context->buildViolation("Si \"Aucun\" est choisi dans la liste, il n'est "
. "pas possible de cocher d'autres indications") . "pas possible de cocher d'autres indications")

View File

@ -791,7 +791,7 @@ class Immersion implements \Stringable
*/ */
public function setNoteImmersion($note) public function setNoteImmersion($note)
{ {
$this->noteImmersion = (string) $note; $this->noteImmersion = $note;
return $this; return $this;
} }

View File

@ -156,7 +156,6 @@ class ProjetProfessionnel implements \Stringable
/** /**
* Set typeContrat. * Set typeContrat.
* *
* @param json|null $typeContrat
* *
* @return ProjetProfessionnel * @return ProjetProfessionnel
*/ */
@ -170,7 +169,6 @@ class ProjetProfessionnel implements \Stringable
/** /**
* Get typeContrat. * Get typeContrat.
* *
* @return json|null
*/ */
public function getTypeContrat() public function getTypeContrat()
{ {
@ -180,7 +178,6 @@ class ProjetProfessionnel implements \Stringable
/** /**
* Set typeContratNotes. * Set typeContratNotes.
* *
*
* @return ProjetProfessionnel * @return ProjetProfessionnel
*/ */
public function setTypeContratNotes(?string $typeContratNotes = null) public function setTypeContratNotes(?string $typeContratNotes = null)
@ -203,7 +200,6 @@ class ProjetProfessionnel implements \Stringable
/** /**
* Set volumeHoraire. * Set volumeHoraire.
* *
* @param json|null $volumeHoraire
* *
* @return ProjetProfessionnel * @return ProjetProfessionnel
*/ */
@ -217,7 +213,6 @@ class ProjetProfessionnel implements \Stringable
/** /**
* Get volumeHoraire. * Get volumeHoraire.
* *
* @return json|null
*/ */
public function getVolumeHoraire() public function getVolumeHoraire()
{ {

View File

@ -41,7 +41,7 @@ class Metier
public function __construct() public function __construct()
{ {
$this->appellations = new ArrayCollection(); $this->appellations = new ArrayCollection();
$this->appellation = new ArrayCollection(); // $this->appellation = new ArrayCollection();
} }
/** /**

View File

@ -15,8 +15,10 @@ use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Export\ListInterface; use Chill\MainBundle\Export\ListInterface;
use Chill\PersonBundle\Export\Export\ListPerson; use Chill\PersonBundle\Export\Export\ListPerson;
use Chill\JobBundle\Entity\CSPerson; use Chill\JobBundle\Entity\CSPerson;
use Chill\PersonBundle\Export\Helper\ListPersonHelper;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query; use Doctrine\ORM\Query;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Templating\TranslatableStringHelper;
@ -61,11 +63,12 @@ class ListCSPerson extends ListPerson implements ListInterface, ExportElementVal
public function __construct( public function __construct(
EntityManagerInterface $em, EntityManagerInterface $em,
TranslatorInterface $translator, ListPersonHelper $listPersonHelper,
TranslatableStringHelper $translatableStringHelper, TranslatableStringHelper $translatableStringHelper,
CustomFieldProvider $customFieldProvider CustomFieldProvider $customFieldProvider,
ParameterBagInterface $parameterBag
) { ) {
parent::__construct($em, $translator, $translatableStringHelper, $customFieldProvider); parent::__construct($customFieldProvider, $listPersonHelper, $em, $translatableStringHelper, $parameterBag);
} }
/** /**
@ -200,14 +203,8 @@ class ListCSPerson extends ListPerson implements ListInterface, ExportElementVal
{ {
$csperson = self::CSPERSON; $csperson = self::CSPERSON;
/**
* @var array $row each row exported
*/
$results = []; $results = [];
foreach ($rows as $row) { foreach ($rows as $row) {
/**
* @var string $key
*/
$res = []; $res = [];
foreach ($row as $key => $value) { foreach ($row as $key => $value) {
switch ($key) { switch ($key) {
@ -359,7 +356,7 @@ class ListCSPerson extends ListPerson implements ListInterface, ExportElementVal
$rsm = new Query\ResultSetMapping(); $rsm = new Query\ResultSetMapping();
foreach ($this->allFields() as $name => $type) { foreach ($this->allFields() as $name => $type) {
if ($data['fields'][$name]) { if (null !== $data['fields'][$name]) {
$rsm->addScalarResult(strtolower($name), $name, $type); $rsm->addScalarResult(strtolower($name), $name, $type);
} }
} }

View File

@ -191,12 +191,10 @@ class ListCV implements ListInterface, ExportElementValidatedInterface
/** /**
* Return the required Role to execute the Export. * Return the required Role to execute the Export.
*
* @return Role
*/ */
public function requiredRole(): string public function requiredRole(): string
{ {
return new Role(ExportsVoter::EXPORT); return ExportsVoter::EXPORT;
} }
/** /**
@ -255,7 +253,7 @@ class ListCV implements ListInterface, ExportElementValidatedInterface
$rsm = new Query\ResultSetMapping(); $rsm = new Query\ResultSetMapping();
foreach (self::FIELDS as $name => $type) { foreach (self::FIELDS as $name => $type) {
if ($data['fields'][$name]) { if (null !== $data['fields'][$name]) {
$rsm->addScalarResult($name, $name, $type); $rsm->addScalarResult($name, $name, $type);
} }
} }
@ -325,7 +323,7 @@ class ListCV implements ListInterface, ExportElementValidatedInterface
if ('_header' === $value) { if ('_header' === $value) {
return $key; return $key;
} }
if (empty($value)) { if (null === $value || '' === $value) {
return ''; return '';
} }
@ -343,7 +341,7 @@ class ListCV implements ListInterface, ExportElementValidatedInterface
if ('_header' === $value) { if ('_header' === $value) {
return $key; return $key;
} }
if (empty($value)) { if (null === $value || '' === $value) {
return ''; return '';
} }

View File

@ -205,11 +205,10 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
/** /**
* Return the required Role to execute the Export. * Return the required Role to execute the Export.
* *
* @return Role
*/ */
public function requiredRole(): string public function requiredRole(): string
{ {
return new Role(ExportsVoter::EXPORT); return ExportsVoter::EXPORT;
} }
/** /**
@ -290,9 +289,6 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
{ {
$freins = self::FREINS; $freins = self::FREINS;
/**
* @var array $row each row exported
*/
$results = []; $results = [];
foreach ($rows as $row) { foreach ($rows as $row) {
/** /**
@ -337,7 +333,7 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
* @param QueryBuilder|\Doctrine\ORM\NativeQuery $qb * @param QueryBuilder|\Doctrine\ORM\NativeQuery $qb
* @param mixed[] $data the data from the export's form (added by self::buildForm) * @param mixed[] $data the data from the export's form (added by self::buildForm)
* *
* @return mixed[]|\closure an array of results * @return mixed[]|\Closure an array of results
*/ */
public function getResult($qb, $data) public function getResult($qb, $data)
{ {
@ -351,7 +347,7 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
$rsm = new Query\ResultSetMapping(); $rsm = new Query\ResultSetMapping();
foreach (self::FIELDS as $name => $type) { foreach (self::FIELDS as $name => $type) {
if ($data['fields'][$name]) { if (null !== $data['fields'][$name]) {
$rsm->addScalarResult($name, $name, $type); $rsm->addScalarResult($name, $name, $type);
} }
} }
@ -423,7 +419,7 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
if ('_header' === $value) { if ('_header' === $value) {
return $key; return $key;
} }
if (empty($value)) { if (null === $value || '' === $value) {
return ''; return '';
} }
@ -441,7 +437,7 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
if ('_header' === $value) { if ('_header' === $value) {
return $key; return $key;
} }
if (empty($value)) { if (null === $value || '' === $value) {
return ''; return '';
} }
@ -451,7 +447,7 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
if ('_header' === $value) { if ('_header' === $value) {
return $key; return $key;
} }
if (empty($value)) { if (null === $value || '' === $value) {
return ''; return '';
} }

View File

@ -211,11 +211,10 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn
/** /**
* Return the required Role to execute the Export. * Return the required Role to execute the Export.
* *
* @return Role
*/ */
public function requiredRole(): string public function requiredRole(): string
{ {
return new Role(ExportsVoter::EXPORT); return ExportsVoter::EXPORT;
} }
/** /**
@ -315,10 +314,8 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn
{ {
$projet_professionnel = self::PPROF; $projet_professionnel = self::PPROF;
/**
* @var array $row each row exported
*/
$results = []; $results = [];
foreach ($rows as $row) { foreach ($rows as $row) {
/** /**
* @var string $key * @var string $key
@ -388,7 +385,7 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn
$rsm = new Query\ResultSetMapping(); $rsm = new Query\ResultSetMapping();
foreach (self::FIELDS as $name => $type) { foreach (self::FIELDS as $name => $type) {
if ($data['fields'][$name]) { if (null !== $data['fields'][$name]) {
$rsm->addScalarResult($name, $name, $type); $rsm->addScalarResult($name, $name, $type);
} }
} }
@ -460,7 +457,7 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn
if ('_header' === $value) { if ('_header' === $value) {
return $key; return $key;
} }
if (empty($value)) { if (null === $value || '' === $value) {
return ''; return '';
} }
@ -488,7 +485,7 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn
if ('_header' === $value) { if ('_header' === $value) {
return $key; return $key;
} }
if (empty($value)) { if (null === $value || '' === $value) {
return ''; return '';
} }
@ -498,7 +495,7 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn
if ('_header' === $value) { if ('_header' === $value) {
return $key; return $key;
} }
if (empty($value)) { if (null === $value || '' === $value) {
return ''; return '';
} }

View File

@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\JobBundle\Form; namespace Chill\JobBundle\Form;
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@ -19,7 +20,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\ThirdPartyBundle\Form\Type\PickThirdPartyType;
class CSPersonDispositifsType extends AbstractType class CSPersonDispositifsType extends AbstractType
{ {
@ -90,7 +90,7 @@ class CSPersonDispositifsType extends AbstractType
'label' => 'Code "Ma démarche FSE"', 'label' => 'Code "Ma démarche FSE"',
'required' => false, 'required' => false,
]) ])
->add('prescripteur', PickThirdPartyType::class, [ ->add('prescripteur', PickThirdpartyDynamicType::class, [
'required' => false, 'required' => false,
'types' => ['prescripteur'], 'types' => ['prescripteur'],
'label' => 'Prescripteur', 'label' => 'Prescripteur',

View File

@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\JobBundle\Form; namespace Chill\JobBundle\Form;
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@ -19,7 +20,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\ThirdPartyBundle\Form\Type\PickThirdPartyType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Chill\DocStoreBundle\Form\StoredObjectType; use Chill\DocStoreBundle\Form\StoredObjectType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType; use Symfony\Component\Form\Extension\Core\Type\MoneyType;
@ -148,7 +148,7 @@ class CSPersonPersonalSituationType extends AbstractType
'choices' => \array_combine(CSPerson::HANDICAP_RECOMMANDATIONS, CSPerson::HANDICAP_RECOMMANDATIONS), 'choices' => \array_combine(CSPerson::HANDICAP_RECOMMANDATIONS, CSPerson::HANDICAP_RECOMMANDATIONS),
'choice_label' => fn ($k) => 'handicap_recommandation.'.$k, 'choice_label' => fn ($k) => 'handicap_recommandation.'.$k,
]) ])
->add('handicapAccompagnement', PickThirdPartyType::class, [ ->add('handicapAccompagnement', PickThirdpartyDynamicType::class, [
'center' => $options['center'], 'center' => $options['center'],
'types' => ['prescripteur'], 'types' => ['prescripteur'],
'required' => false, 'required' => false,

View File

@ -11,12 +11,12 @@ declare(strict_types=1);
namespace Chill\JobBundle\Form\ChoiceLoader; namespace Chill\JobBundle\Form\ChoiceLoader;
use Chill\FranceTravailApiBundle\ApiHelper\PartenaireRomeAppellation;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList; use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Chill\JobBundle\Entity\Rome\Appellation; use Chill\JobBundle\Entity\Rome\Appellation;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Chill\PoleEmploiApiBundle\ApiHelper\PartenaireRomeAppellation;
use Chill\JobBundle\Entity\Rome\Metier; use Chill\JobBundle\Entity\Rome\Metier;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
@ -72,25 +72,26 @@ class RomeAppellationChoiceLoader implements ChoiceLoaderInterface
public function loadChoicesForValues($values, $value = null) public function loadChoicesForValues($values, $value = null)
{ {
$choices = []; $choices = [];
$code = '';
foreach ($values as $v) { foreach ($values as $v) {
if (empty($v)) { if (null === $v || '' === $v) {
continue; continue;
} }
// start with "original-" ? then we load from api // start with "original-" ? then we load from api
if (str_starts_with($v, 'original-')) { if (str_starts_with($v, 'original-')) {
$code = \substr($v, \strlen('original-')); $code = \substr($v, \strlen('original-'));
$appellation = $this->appellationRepository->findOneByCode($code); $appellation = $this->appellationRepository->findOneBy(['code' => $code]);
} else { } else {
$id = $v; $id = $v;
$appellation = $this->appellationRepository->find($id); $appellation = $this->appellationRepository->find($id);
} }
if (null === $appellation) { if (null === $appellation && '' !== $code) {
$def = $this->apiAppellation->getAppellation($code); $def = $this->apiAppellation->getAppellation($code);
$metier = $this->em->getRepository(Metier::class) $metier = $this->em->getRepository(Metier::class)
->findOneByCode($def->metier->code) ->findOneBy(['code' => $def->metier->code])
; ;
if (null === $metier) { if (null === $metier) {
@ -108,7 +109,7 @@ class RomeAppellationChoiceLoader implements ChoiceLoaderInterface
->setMetier($metier) ->setMetier($metier)
; ;
if ($this->validator->validate($appellation) && $this->validator->validate($metier)) { if ([] === $this->validator->validate($appellation) && [] === $this->validator->validate($metier)) {
$this->em->persist($appellation); $this->em->persist($appellation);
} }
} }
@ -123,6 +124,8 @@ class RomeAppellationChoiceLoader implements ChoiceLoaderInterface
public function loadValuesForChoices(array $choices, $value = null) public function loadValuesForChoices(array $choices, $value = null)
{ {
$values = [];
foreach ($choices as $choice) { foreach ($choices as $choice) {
if (null === $choice) { if (null === $choice) {
$values[] = null; $values[] = null;

View File

@ -11,13 +11,13 @@ declare(strict_types=1);
namespace Chill\JobBundle\Form; namespace Chill\JobBundle\Form;
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\ChillDateType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Chill\ThirdPartyBundle\Form\Type\PickThirdPartyType;
use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Chill\MainBundle\Form\Type\DateIntervalType; use Chill\MainBundle\Form\Type\DateIntervalType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@ -30,7 +30,7 @@ class ImmersionType extends AbstractType
{ {
if ('immersion' === $options['step']) { if ('immersion' === $options['step']) {
$builder $builder
->add('entreprise', PickThirdPartyType::class, [ ->add('entreprise', PickThirdpartyDynamicType::class, [
'center' => $options['center'], 'center' => $options['center'],
'types' => ['entreprise'], 'types' => ['entreprise'],
'label' => "Identité de l'entreprise", 'label' => "Identité de l'entreprise",

View File

@ -52,7 +52,7 @@ class CSConnectesVoter extends AbstractChillVoter implements ProvideRoleHierarch
protected function supports($attribute, $subject) protected function supports($attribute, $subject)
{ {
if (!\in_array($attribute, self::ALL)) { if (!\in_array($attribute, self::ALL, true)) {
return false; return false;
} }

View File

@ -68,7 +68,7 @@ class ExportsVoter extends AbstractChillVoter implements ProvideRoleHierarchyInt
return false; return false;
} }
$centers = $this->authorizationHelper->getReachableCenters($user, new Role($attribute)); $centers = $this->authorizationHelper->getReachableCenters($user, $attribute);
if (null === $subject) { if (null === $subject) {
return count($centers) > 0; return count($centers) > 0;

View File

@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\Response;
*/ */
class EntityPersonCRUDController extends CRUDController class EntityPersonCRUDController extends CRUDController
{ {
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} public function __construct(protected readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/** /**
* Override the base method to add a filtering step to a person. * Override the base method to add a filtering step to a person.