diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php index a80653441..ad5910461 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php @@ -44,14 +44,7 @@ class UrgencyAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { $qb->addSelect('cal.urgent AS urgency_aggregator'); - - $groupBy = $qb->getDQLPart('groupBy'); - - if (!empty($groupBy)) { - $qb->addGroupBy('urgency_aggregator'); - } else { - $qb->groupBy('urgency_aggregator'); - } + $qb->addGroupBy('urgency_aggregator'); } public function applyOn(): string diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php index fde867b64..d6c38e163 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php @@ -49,23 +49,11 @@ class CalendarRangeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $where = $qb->getDQLPart('where'); - - dump($data); - - if ($data['hasCalendarRange']) { - $clause = $qb->expr()->isNotNull('cal.calendarRange'); + if (null !== $data['hasCalendarRange']) { + $qb->andWhere($qb->expr()->isNotNull('cal.calendarRange')); } else { - $clause = $qb->expr()->isNull('cal.calendarRange'); + $qb->andWhere($qb->expr()->isNull('cal.calendarRange')); } - - if ($where instanceof Andx) { - $where->add($clause); - } else { - $where = $qb->expr()->andX($clause); - } - - $qb->add('where', $where); } public function applyOn(): string @@ -87,6 +75,8 @@ class CalendarRangeFilter implements FilterInterface public function describeAction($data, $format = 'string'): array { + $choice = ''; + foreach (self::CHOICES as $k => $v) { if ($v === $data['hasCalendarRange']) { $choice = $k; diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php index 94ba4974c..f97cbc7b2 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarEntityListener.php @@ -22,6 +22,9 @@ use Chill\CalendarBundle\Entity\Calendar; use Chill\CalendarBundle\Messenger\Message\CalendarMessage; use Chill\CalendarBundle\Messenger\Message\CalendarRemovedMessage; use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\Event\PostPersistEventArgs; +use Doctrine\ORM\Event\PostRemoveEventArgs; +use Doctrine\ORM\Event\PostUpdateEventArgs; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Security\Core\Security; @@ -37,7 +40,7 @@ class CalendarEntityListener $this->security = $security; } - public function postPersist(Calendar $calendar, LifecycleEventArgs $args): void + public function postPersist(Calendar $calendar, PostPersistEventArgs $args): void { if (!$calendar->preventEnqueueChanges) { $this->messageBus->dispatch( @@ -50,7 +53,7 @@ class CalendarEntityListener } } - public function postRemove(Calendar $calendar, LifecycleEventArgs $args): void + public function postRemove(Calendar $calendar, PostRemoveEventArgs $args): void { if (!$calendar->preventEnqueueChanges) { $this->messageBus->dispatch( @@ -62,7 +65,7 @@ class CalendarEntityListener } } - public function postUpdate(Calendar $calendar, LifecycleEventArgs $args): void + public function postUpdate(Calendar $calendar, PostUpdateEventArgs $args): void { if (!$calendar->preventEnqueueChanges) { $this->messageBus->dispatch( diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php index 7628c7af4..4df548277 100644 --- a/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php +++ b/src/Bundle/ChillCalendarBundle/Messenger/Doctrine/CalendarRangeEntityListener.php @@ -22,6 +22,9 @@ use Chill\CalendarBundle\Entity\CalendarRange; use Chill\CalendarBundle\Messenger\Message\CalendarRangeMessage; use Chill\CalendarBundle\Messenger\Message\CalendarRangeRemovedMessage; use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\Event\PostPersistEventArgs; +use Doctrine\ORM\Event\PostRemoveEventArgs; +use Doctrine\ORM\Event\PostUpdateEventArgs; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Security\Core\Security; @@ -37,7 +40,7 @@ class CalendarRangeEntityListener $this->security = $security; } - public function postPersist(CalendarRange $calendarRange, LifecycleEventArgs $eventArgs): void + public function postPersist(CalendarRange $calendarRange, PostPersistEventArgs $eventArgs): void { if (!$calendarRange->preventEnqueueChanges) { $this->messageBus->dispatch( @@ -50,7 +53,7 @@ class CalendarRangeEntityListener } } - public function postRemove(CalendarRange $calendarRange, LifecycleEventArgs $eventArgs): void + public function postRemove(CalendarRange $calendarRange, PostRemoveEventArgs $eventArgs): void { if (!$calendarRange->preventEnqueueChanges) { $this->messageBus->dispatch( @@ -62,7 +65,7 @@ class CalendarRangeEntityListener } } - public function postUpdate(CalendarRange $calendarRange, LifecycleEventArgs $eventArgs): void + public function postUpdate(CalendarRange $calendarRange, PostUpdateEventArgs $eventArgs): void { if (!$calendarRange->preventEnqueueChanges) { $this->messageBus->dispatch( diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php index 984e77d87..c5a640f32 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php @@ -110,11 +110,11 @@ class CalendarSyncer $endDate = RemoteEventConverter::convertStringDateWithoutTimezone($new['end']['dateTime']); if ($startDate->getTimestamp() !== $calendar->getStartDate()->getTimestamp()) { - $calendar->setStartDate($startDate)->setStatus(Calendar::STATUS_MOVED); + $calendar->setStartDate($startDate); } if ($endDate->getTimestamp() !== $calendar->getEndDate()->getTimestamp()) { - $calendar->setEndDate($endDate)->setStatus(Calendar::STATUS_MOVED); + $calendar->setEndDate($endDate); } $calendar diff --git a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php index e83271296..daf2b541f 100644 --- a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php +++ b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php @@ -17,6 +17,7 @@ use DateTimeImmutable; use DateTimeInterface; use Doctrine\ORM\Event\LifecycleEventArgs; use Doctrine\ORM\Event\PreFlushEventArgs; +use Doctrine\ORM\Event\PrePersistEventArgs; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; @@ -133,7 +134,7 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac /** * @ORM\PrePersist */ - public function onPrePersist(LifecycleEventArgs $eventArgs): void + public function onPrePersist(PrePersistEventArgs $eventArgs): void { $this->recentlyPersisted = true; } diff --git a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php index 633dc10ee..a17ffbdae 100644 --- a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php @@ -17,6 +17,8 @@ use Chill\MainBundle\Entity\User; use Chill\MainBundle\Repository\NotificationRepository; use Chill\MainBundle\Templating\UI\NotificationCounterInterface; use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\Event\PostPersistEventArgs; +use Doctrine\ORM\Event\PostUpdateEventArgs; use Doctrine\ORM\Event\PreFlushEventArgs; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -68,7 +70,7 @@ final class NotificationByUserCounter implements NotificationCounterInterface return 'chill_main_notif_unread_by_' . $user->getId(); } - public function onEditNotificationComment(NotificationComment $notificationComment, LifecycleEventArgs $eventArgs): void + public function onEditNotificationComment(NotificationComment $notificationComment, PostPersistEventArgs $eventArgs): void { $this->resetCacheForNotification($notificationComment->getNotification()); } diff --git a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php index 81496a9a9..5290492b1 100644 --- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php @@ -14,6 +14,8 @@ namespace Chill\MainBundle\Notification\Email; use Chill\MainBundle\Entity\Notification; use Chill\MainBundle\Entity\NotificationComment; use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\Event\PostPersistEventArgs; +use Doctrine\ORM\Event\PostUpdateEventArgs; use Psr\Log\LoggerInterface; use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Component\Mailer\Exception\TransportExceptionInterface; @@ -36,7 +38,7 @@ class NotificationMailer $this->translator = $translator; } - public function postPersistComment(NotificationComment $comment, LifecycleEventArgs $eventArgs): void + public function postPersistComment(NotificationComment $comment, PostPersistEventArgs $eventArgs): void { foreach ( array_merge( @@ -72,13 +74,13 @@ class NotificationMailer /** * Send a email after a notification is persisted. */ - public function postPersistNotification(Notification $notification, LifecycleEventArgs $eventArgs): void + public function postPersistNotification(Notification $notification, PostPersistEventArgs $eventArgs): void { $this->sendNotificationEmailsToAddresses($notification); $this->sendNotificationEmailsToAddressesEmails($notification); } - public function postUpdateNotification(Notification $notification, LifecycleEventArgs $eventArgs): void + public function postUpdateNotification(Notification $notification, PostUpdateEventArgs $eventArgs): void { $this->sendNotificationEmailsToAddressesEmails($notification); } diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListener.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListener.php index 2479920af..37f309929 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListener.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListener.php @@ -14,6 +14,8 @@ namespace Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\Event\PrePersistEventArgs; +use Doctrine\ORM\Event\PreUpdateEventArgs; /** * This service listens for preUpdate and prePersist events on some entities @@ -26,22 +28,22 @@ use Doctrine\ORM\Event\LifecycleEventArgs; */ final class AccompanyingPeriodSocialIssueConsistencyEntityListener { - public function prePersist(AccompanyingPeriodLinkedWithSocialIssuesEntityInterface $entity, LifecycleEventArgs $eventArgs) + public function prePersist(AccompanyingPeriodLinkedWithSocialIssuesEntityInterface $entity, PrePersistEventArgs $eventArgs) { $this->ensureConsistencyEntity($entity); } - public function prePersistAccompanyingPeriod(AccompanyingPeriod $period, LifecycleEventArgs $eventArgs) + public function prePersistAccompanyingPeriod(AccompanyingPeriod $period, PrePersistEventArgs $eventArgs) { $this->ensureConsistencyAccompanyingPeriod($period); } - public function preUpdate(AccompanyingPeriodLinkedWithSocialIssuesEntityInterface $entity, LifecycleEventArgs $eventArgs) + public function preUpdate(AccompanyingPeriodLinkedWithSocialIssuesEntityInterface $entity, PreUpdateEventArgs $eventArgs) { $this->ensureConsistencyEntity($entity); } - public function preUpdateAccompanyingPeriod(AccompanyingPeriod $period, LifecycleEventArgs $eventArgs) + public function preUpdateAccompanyingPeriod(AccompanyingPeriod $period, PreUpdateEventArgs $eventArgs) { $this->ensureConsistencyAccompanyingPeriod($period); } diff --git a/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php b/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php index e0c22293b..841aaaaf8 100644 --- a/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php +++ b/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php @@ -51,6 +51,9 @@ use function json_decode; use const JSON_PRETTY_PRINT; use const LC_TIME; +/** + * @deprecated, to remove in a next version + */ final class ImportPeopleFromCSVCommand extends Command { protected $cacheAnswersMapping = []; @@ -1021,6 +1024,7 @@ final class ImportPeopleFromCSVCommand extends Command foreach ($possibleFormats as $format) { $this->logger->debug("Trying format {$format}", [__METHOD__]); + /** @phpstan-ignore-next-line */ $dateR = strptime($value, $format); if (is_array($dateR) && '' === $dateR['unparsed']) { diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 19c275f17..4dd297b9f 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -881,7 +881,7 @@ class AccompanyingPeriod implements /** * Get a list of all persons which are participating to this course. * - * @psalm-return Collection + * @psalm-return Collection<(int|string), Person|null> */ public function getPersons(): Collection {