Remove usage of deprecated Role class

This commit is contained in:
2023-08-31 17:08:18 +02:00
parent 76142c1264
commit 7c58880139
33 changed files with 55 additions and 80 deletions

View File

@@ -294,9 +294,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
*
*
* @ORM\Column(type="text", nullable=true)
* @Assert\Email(
* checkMX=true
* )
* @Assert\Email()
*/
private string $email = '';

View File

@@ -81,7 +81,7 @@ class AccompanyingPeriodType extends AbstractType
if ('visible' === $this->config['user']) {
$builder->add('user', UserPickerType::class, [
'center' => $options['center'],
'role' => new Role(PersonVoter::SEE),
'role' => PersonVoter::SEE,
]);
}

View File

@@ -107,7 +107,7 @@ class PickPersonType extends AbstractType
->addAllowedTypes('centers', ['array', Center::class, 'null'])
->setDefault('centers', null)
->setDefined('role')
->addAllowedTypes('role', [Role::class, 'null'])
->addAllowedTypes('role', ['string', 'null'])
->setDefault('role', null);
// add the default options

View File

@@ -133,7 +133,7 @@ final class PickPersonTypeTest extends KernelTestCase
$this->markTestSkipped('need to inject locale into url generator without request');
$form = $this->formFactory
->createBuilder(PickPersonType::class, null, [
'role' => new \Symfony\Component\Security\Core\Role\Role('INVALID'),
'role' => 'INVALID',
])
->getForm();

View File

@@ -58,7 +58,7 @@ class PersonListWidget implements WidgetInterface
// show only the person from the authorized centers
$and = $qb->expr()->andX();
$centers = $this->authorizationHelper
->getReachableCenters($this->getUser(), new Role(PersonVoter::SEE));
->getReachableCenters($this->getUser(), PersonVoter::SEE);
$and->add($qb->expr()->in('person.center', ':centers'));
$qb->setParameter('centers', $centers);