diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index b81d3937c..9a391d14d 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -90,7 +90,6 @@ final class ActivityController extends AbstractController SerializerInterface $serializer, UserRepositoryInterface $userRepository, CenterResolverManagerInterface $centerResolver - ) { $this->activityACLAwareRepository = $activityACLAwareRepository; $this->activityTypeRepository = $activityTypeRepository; @@ -106,7 +105,6 @@ final class ActivityController extends AbstractController $this->serializer = $serializer; $this->userRepository = $userRepository; $this->centerResolver = $centerResolver; - } /** diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 402b2b5a2..e519997d0 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -409,16 +409,16 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface return $this->status; } - public function getUrgent(): ?bool - { - return $this->urgent; - } - public function getThirdParties(): Collection { return $this->getProfessionals(); } + public function getUrgent(): ?bool + { + return $this->urgent; + } + /** * @return Collection|User[] * @Serializer\Groups({"calendar:read", "read"}) @@ -599,13 +599,6 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface return $this; } - public function setUrgent(bool $urgent): self - { - $this->urgent = $urgent; - - return $this; - } - public function setStartDate(DateTimeImmutable $startDate): self { $this->startDate = $startDate; @@ -623,4 +616,11 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface return $this; } + + public function setUrgent(bool $urgent): self + { + $this->urgent = $urgent; + + return $this; + } } diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php index 013b465d5..beeb055e1 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php @@ -127,7 +127,7 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface public function setLocation(?Location $location): self { $this->location = $location; - + return $this; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php index 1f494fe96..f5c0f5f17 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php @@ -54,8 +54,8 @@ class MonthYearAggregator implements AggregatorInterface return 'by month and year'; } - $month = (int)substr($value, 0, 2); - $year = (int)substr($value, 3, 4); + $month = (int) substr($value, 0, 2); + $year = (int) substr($value, 3, 4); return strftime('%B %G', mktime(0, 0, 0, $month, 1, $year)); }; diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php index ad19ee7e1..94204cc9a 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php @@ -21,7 +21,6 @@ use Symfony\Contracts\Translation\TranslatorInterface; class UrgencyAggregator implements AggregatorInterface { - private TranslatorInterface $translator; public function __construct( @@ -88,4 +87,3 @@ class UrgencyAggregator implements AggregatorInterface return 'Group calendars by urgency'; } } - diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php index 9d78d0f26..4d246cafa 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php @@ -23,7 +23,6 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Exception\LogicException; - class CountCalendars implements ExportInterface, GroupedExportInterface { private CalendarRepository $calendarRepository; diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php index 9900d58de..3189d6df6 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php @@ -11,8 +11,8 @@ declare(strict_types=1); namespace Chill\CalendarBundle\Export\Filter; -use Chill\MainBundle\Export\FilterInterface; use Chill\CalendarBundle\Export\Declarations; +use Chill\MainBundle\Export\FilterInterface; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -23,7 +23,7 @@ class CalendarRangeFilter implements FilterInterface { private const CHOICES = [ 'Not made within a calendar range' => true, - 'Made within a calendar range' => false + 'Made within a calendar range' => false, ]; private const DEFAULT_CHOICE = false; @@ -52,7 +52,6 @@ class CalendarRangeFilter implements FilterInterface $clause = $qb->expr()->isNull('cal.calendarRange'); } - if ($where instanceof Andx) { $where->add($clause); } else { @@ -101,4 +100,3 @@ class CalendarRangeFilter implements FilterInterface return 'Filter by calendar range'; } } - diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php index 7e7d55739..402da0b73 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MapCalendarToUser.php @@ -143,7 +143,7 @@ class MapCalendarToUser public function writeMetadata(User $user): User { - if (null === $user->getEmail() OR '' === $user->getEmail()) { + if (null === $user->getEmail() || '' === $user->getEmail()) { return $user; } diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php index 626a9f29f..28b2b72b9 100644 --- a/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php +++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php @@ -40,11 +40,6 @@ class CalendarRepository implements ObjectRepository return $this->repository->count(['accompanyingPeriod' => $period]); } - public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder - { - return $this->repository->createQueryBuilder($alias, $indexBy); - } - public function countByUser(User $user, DateTimeImmutable $from, DateTimeImmutable $to): int { return $this->buildQueryByUser($user, $from, $to) @@ -53,6 +48,11 @@ class CalendarRepository implements ObjectRepository ->getSingleScalarResult(); } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder + { + return $this->repository->createQueryBuilder($alias, $indexBy); + } + public function find($id): ?Calendar { return $this->repository->find($id); diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php index 6e50eebc4..99f34358e 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/AgentAggregatorTest.php @@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\AgentAggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Doctrine\ORM\EntityManagerInterface; +/** + * @internal + * @coversNothing + */ final class AgentAggregatorTest extends AbstractAggregatorTest { private AgentAggregator $aggregator; @@ -51,8 +55,7 @@ final class AgentAggregatorTest extends AbstractAggregatorTest $em->createQueryBuilder() ->select('count(cal.id)') ->from(Calendar::class, 'cal') - ->join('cal.mainUser', 'caluser') - , + ->join('cal.mainUser', 'caluser'), ]; } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php index 3d871d542..b78ff4307 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/CancelReasonAggregatorTest.php @@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\CancelReasonAggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Doctrine\ORM\EntityManagerInterface; +/** + * @internal + * @coversNothing + */ final class CancelReasonAggregatorTest extends AbstractAggregatorTest { private CancelReasonAggregator $aggregator; @@ -51,8 +55,7 @@ final class CancelReasonAggregatorTest extends AbstractAggregatorTest $em->createQueryBuilder() ->select('count(cal.id)') ->from(Calendar::class, 'cal') - ->join('cal.cancelReason', 'calcancel') - , + ->join('cal.cancelReason', 'calcancel'), ]; } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php index 278bf2254..7ee333486 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/JobAggregatorTest.php @@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\JobAggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Doctrine\ORM\EntityManagerInterface; +/** + * @internal + * @coversNothing + */ final class JobAggregatorTest extends AbstractAggregatorTest { private JobAggregator $aggregator; @@ -51,8 +55,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest $em->createQueryBuilder() ->select('count(cal.id)') ->from(Calendar::class, 'cal') - ->join('cal.user', 'caluser') - , + ->join('cal.user', 'caluser'), ]; } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php index 49d7530cf..b11b5304b 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationAggregatorTest.php @@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\LocationAggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Doctrine\ORM\EntityManagerInterface; +/** + * @internal + * @coversNothing + */ final class LocationAggregatorTest extends AbstractAggregatorTest { private LocationAggregator $aggregator; @@ -51,8 +55,7 @@ final class LocationAggregatorTest extends AbstractAggregatorTest $em->createQueryBuilder() ->select('count(cal.id)') ->from(Calendar::class, 'cal') - ->join('cal.location', 'calloc') - , + ->join('cal.location', 'calloc'), ]; } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php index c06d2f036..ee2ae8ca5 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/LocationTypeAggregatorTest.php @@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\LocationTypeAggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Doctrine\ORM\EntityManagerInterface; +/** + * @internal + * @coversNothing + */ final class LocationTypeAggregatorTest extends AbstractAggregatorTest { private LocationTypeAggregator $aggregator; @@ -51,8 +55,7 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest $em->createQueryBuilder() ->select('count(cal.id)') ->from(Calendar::class, 'cal') - ->join('cal.location', 'calloc') - , + ->join('cal.location', 'calloc'), ]; } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php index 885344148..830e569a1 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/MonthYearAggregatorTest.php @@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\MonthYearAggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Doctrine\ORM\EntityManagerInterface; +/** + * @internal + * @coversNothing + */ final class MonthYearAggregatorTest extends AbstractAggregatorTest { private MonthYearAggregator $aggregator; @@ -50,8 +54,7 @@ final class MonthYearAggregatorTest extends AbstractAggregatorTest return [ $em->createQueryBuilder() ->select('count(cal.id)') - ->from(Calendar::class, 'cal') - , + ->from(Calendar::class, 'cal'), ]; } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php index b95fd6f86..9c90231cf 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Aggregator/ScopeAggregatorTest.php @@ -16,6 +16,10 @@ use Chill\CalendarBundle\Export\Aggregator\ScopeAggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Doctrine\ORM\EntityManagerInterface; +/** + * @internal + * @coversNothing + */ final class ScopeAggregatorTest extends AbstractAggregatorTest { private ScopeAggregator $aggregator; @@ -51,8 +55,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest $em->createQueryBuilder() ->select('count(cal.id)') ->from(Calendar::class, 'cal') - ->join('cal.user', 'caluser') - , + ->join('cal.user', 'caluser'), ]; } } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php index de7d76601..a79775fd5 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/AgentFilterTest.php @@ -57,7 +57,7 @@ final class AgentFilterTest extends AbstractFilterTest foreach ($array as $a) { $data[] = [ - 'accepted_agents' => $a + 'accepted_agents' => $a, ]; } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php index f51aa4474..260d9f4d2 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/BetweenDatesFilterTest.php @@ -14,6 +14,7 @@ namespace Chill\CalendarBundle\Tests\Export\Filter; use Chill\CalendarBundle\Entity\Calendar; use Chill\CalendarBundle\Export\Filter\BetweenDatesFilter; use Chill\MainBundle\Test\Export\AbstractFilterTest; +use DateTime; use Doctrine\ORM\EntityManagerInterface; /** @@ -46,9 +47,9 @@ final class BetweenDatesFilterTest extends AbstractFilterTest { return [ [ - 'date_from' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'), - 'date_to' => \DateTime::createFromFormat('Y-m-d', '2022-06-01'), - ] + 'date_from' => DateTime::createFromFormat('Y-m-d', '2022-05-01'), + 'date_to' => DateTime::createFromFormat('Y-m-d', '2022-06-01'), + ], ]; } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/JobFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/JobFilterTest.php index b036f55fa..fcb14bfb0 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/JobFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/JobFilterTest.php @@ -57,7 +57,7 @@ final class JobFilterTest extends AbstractFilterTest foreach ($array as $a) { $data[] = [ - 'job' => $a + 'job' => $a, ]; } diff --git a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/ScopeFilterTest.php b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/ScopeFilterTest.php index e249c194f..727e0e258 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/ScopeFilterTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Export/Filter/ScopeFilterTest.php @@ -57,7 +57,7 @@ final class ScopeFilterTest extends AbstractFilterTest foreach ($array as $a) { $data[] = [ - 'scope' => $a + 'scope' => $a, ]; } diff --git a/src/Bundle/ChillCalendarBundle/migrations/Version20220921101643.php b/src/Bundle/ChillCalendarBundle/migrations/Version20220921101643.php index 270c57da4..6dd872540 100644 --- a/src/Bundle/ChillCalendarBundle/migrations/Version20220921101643.php +++ b/src/Bundle/ChillCalendarBundle/migrations/Version20220921101643.php @@ -1,5 +1,12 @@ addSql('ALTER TABLE chill_calendar.calendar DROP urgent'); + } + public function getDescription(): string { return 'Add urgent property to calendar entity'; @@ -21,13 +34,5 @@ final class Version20220921101643 extends AbstractMigration { // this up() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE chill_calendar.calendar ADD urgent BOOLEAN DEFAULT NULL'); - - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE chill_calendar.calendar DROP urgent'); - } } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php index c764bdbb7..e069af849 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php @@ -42,7 +42,7 @@ class DeadOrAliveFilter implements FilterInterface 'person.birthdate', ':date_calc' ) - ), + ), $qb->expr()->andX( $qb->expr()->isNotNull('person.deathdate'), $qb->expr()->gt(