WIP: remove deprecations

This commit is contained in:
2023-05-06 21:26:53 +02:00
parent 958e2b5cf2
commit 13bc9683fb
35 changed files with 117 additions and 110 deletions

View File

@@ -11,7 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Actions;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Event triggered when an entity attached to a person is removed.

View File

@@ -19,7 +19,7 @@ use Chill\PersonBundle\Form\AccompanyingCourseType;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -39,7 +39,7 @@ use function is_array;
/**
* Class AccompanyingCourseController.
*/
class AccompanyingCourseController extends Controller
class AccompanyingCourseController extends AbstractController
{
public function __construct(protected SerializerInterface $serializer, protected EventDispatcherInterface $dispatcher, protected ValidatorInterface $validator, private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly Registry $registry, private readonly TranslatorInterface $translator)
{

View File

@@ -25,6 +25,7 @@ use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Search\SimilarPersonMatcher;
use Chill\TaskBundle\Entity\SingleTask;
use http\Exception\InvalidArgumentException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -32,10 +33,15 @@ use Symfony\Contracts\Translation\TranslatorInterface;
use function count;
class PersonDuplicateController extends Controller
class PersonDuplicateController extends AbstractController
{
public function __construct(private readonly SimilarPersonMatcher $similarPersonMatcher, private readonly TranslatorInterface $translator, private readonly PersonRepository $personRepository, private readonly PersonMove $personMove, private readonly EventDispatcherInterface $eventDispatcher)
{
public function __construct(
private readonly SimilarPersonMatcher $similarPersonMatcher,
private readonly TranslatorInterface $translator,
private readonly PersonRepository $personRepository,
private readonly PersonMove $personMove,
private readonly EventDispatcherInterface $eventDispatcher
) {
}
public function confirmAction($person1_id, $person2_id, Request $request)

View File

@@ -26,6 +26,8 @@ use Symfony\Component\Security\Core\Role\Role;
/**
* Class AccompanyingPeriodType.
*
* @deprecated to be removed
*/
class AccompanyingPeriodType extends AbstractType
{
@@ -81,7 +83,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

@@ -213,7 +213,7 @@ class PersonType extends AbstractType
]);
}
if ($options['cFGroup']) {
if (null !== $options['cFGroup']) {
$builder
->add(
'cFData',

View File

@@ -44,6 +44,8 @@ use function is_array;
* `Chill\MainBundle\Entity\Center`. By default, all the reachable centers as selected.
* - with the `role` option, only the people belonging to the reachable center for the
* given role are displayed.
*
* @deprecated use @link{\Chill\PersonBundle\Form\Type\PickPersonDynamicType::class} instead
*/
class PickPersonType extends AbstractType
{
@@ -107,7 +109,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

@@ -32,7 +32,7 @@ namespace Chill\PersonBundle\Privacy;
*/
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
class AccompanyingPeriodPrivacyEvent extends Event
{

View File

@@ -32,8 +32,8 @@ namespace Chill\PersonBundle\Privacy;
*/
use Chill\PersonBundle\Entity\Person;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
use function count;
/**

View File

@@ -18,7 +18,7 @@ use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\UserJob;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
@@ -35,16 +35,18 @@ use function count;
final readonly class AccompanyingPeriodACLAwareRepository implements AccompanyingPeriodACLAwareRepositoryInterface
{
public function __construct(private AccompanyingPeriodRepository $accompanyingPeriodRepository, private Security $security, private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher)
{
public function __construct(
private AccompanyingPeriodRepository $accompanyingPeriodRepository,
private Security $security,
private AuthorizationHelper $authorizationHelper,
private CenterResolverManagerInterface $centerResolverDispatcher
) {
}
/**
* @param array|PostalCode[]
*
* @return QueryBuilder
* @param array<PostalCode> $postalCodes
*/
public function buildQueryOpenedAccompanyingCourseByUser(?User $user, array $postalCodes = [])
public function buildQueryOpenedAccompanyingCourseByUser(?User $user, array $postalCodes = []): QueryBuilder
{
$qb = $this->accompanyingPeriodRepository->createQueryBuilder('ap');
@@ -139,7 +141,7 @@ final readonly class AccompanyingPeriodACLAwareRepository implements Accompanyin
->getReachableCircles(
$this->security->getUser(),
$role,
$this->centerResolverDispatcher->resolveCenter($person)
$this->centerResolverDispatcher->resolveCenters($person)
);
if (0 === count($scopes)) {

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);