Revert "Merge branch 'revert-671bb6d5' into 'master'"

This reverts merge request !732
This commit is contained in:
2024-09-19 13:40:09 +00:00
parent bfd7dc2270
commit 68688dd528
1701 changed files with 35022 additions and 14546 deletions

View File

@@ -56,7 +56,7 @@ class AzureGrantAdminConsentAndAcquireToken extends Command
$messages = ['No problem, we will wait for you', 'Grant access and come back here'];
$output->writeln($formatter->formatBlock($messages, 'warning'));
return 0;
return Command::SUCCESS;
}
$token = $this->machineTokenStorage->getToken();
@@ -69,6 +69,6 @@ class AzureGrantAdminConsentAndAcquireToken extends Command
$output->writeln('Expires at: '.$token->getExpires());
$output->writeln('To inspect the token content, go to https://jwt.ms/#access_token='.urlencode($token->getToken()));
return 0;
return Command::SUCCESS;
}
}

View File

@@ -32,6 +32,8 @@ use Symfony\Component\Console\Output\OutputInterface;
final class MapAndSubscribeUserCalendarCommand extends Command
{
protected static $defaultDescription = 'MSGraph: collect user metadata and create subscription on events for users, and sync the user absence-presence';
public function __construct(
private readonly EntityManagerInterface $em,
private readonly EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator,
@@ -151,7 +153,7 @@ final class MapAndSubscribeUserCalendarCommand extends Command
$output->writeln('users synchronized');
return 0;
return Command::SUCCESS;
}
protected function configure()
@@ -159,7 +161,6 @@ final class MapAndSubscribeUserCalendarCommand extends Command
parent::configure();
$this
->setDescription('MSGraph: collect user metadata and create subscription on events for users, and sync the user absence-presence')
->addOption(
'renew-before-end-interval',
'r',

View File

@@ -27,18 +27,13 @@ class SendShortMessageOnEligibleCalendar extends Command
{
public function __construct(private readonly BulkCalendarShortMessageSender $messageSender)
{
parent::__construct();
}
public function getName()
{
return 'chill:calendar:send-short-messages';
parent::__construct('chill:calendar:send-short-messages');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->messageSender->sendBulkMessageToEligibleCalendars();
return 0;
return Command::SUCCESS;
}
}

View File

@@ -39,6 +39,8 @@ use Symfony\Component\Console\Question\Question;
class SendTestShortMessageOnCalendarCommand extends Command
{
protected static $defaultDescription = 'Test sending a SMS for a dummy calendar appointment';
public function __construct(
private readonly PersonRepository $personRepository,
private readonly PhoneNumberUtil $phoneNumberUtil,
@@ -47,18 +49,10 @@ class SendTestShortMessageOnCalendarCommand extends Command
private readonly ShortMessageTransporterInterface $transporter,
private readonly UserRepositoryInterface $userRepository,
) {
parent::__construct();
parent::__construct('chill:calendar:test-send-short-message');
}
public function getName()
{
return 'chill:calendar:test-send-short-message';
}
protected function configure()
{
$this->setDescription('Test sending a SMS for a dummy calendar appointment');
}
protected function configure() {}
protected function execute(InputInterface $input, OutputInterface $output): int
{
@@ -179,6 +173,6 @@ class SendTestShortMessageOnCalendarCommand extends Command
}
}
return 0;
return Command::SUCCESS;
}
}

View File

@@ -18,9 +18,8 @@ class AdminController extends AbstractController
{
/**
* Calendar admin.
*
* @Route("/{_locale}/admin/calendar", name="chill_calendar_admin_index")
*/
#[Route(path: '/{_locale}/admin/calendar', name: 'chill_calendar_admin_index')]
public function indexAdminAction()
{
return $this->render('@ChillCalendar/Admin/index.html.twig');

View File

@@ -23,16 +23,9 @@ use Symfony\Component\Routing\Annotation\Route;
class CalendarAPIController extends ApiController
{
public function __construct(private readonly CalendarRepository $calendarRepository)
{
}
public function __construct(private readonly CalendarRepository $calendarRepository) {}
/**
* @Route("/api/1.0/calendar/calendar/by-user/{id}.{_format}",
* name="chill_api_single_calendar_list_by-user",
* requirements={"_format": "json"}
* )
*/
#[Route(path: '/api/1.0/calendar/calendar/by-user/{id}.{_format}', name: 'chill_api_single_calendar_list_by-user', requirements: ['_format' => 'json'])]
public function listByUser(User $user, Request $request, string $_format): JsonResponse
{
$this->denyAccessUnlessGranted('ROLE_USER');

View File

@@ -59,17 +59,16 @@ class CalendarController extends AbstractController
private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository,
private readonly UserRepositoryInterface $userRepository,
private readonly TranslatorInterface $translator,
) {
}
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
) {}
/**
* Delete a calendar item.
*
* @Route("/{_locale}/calendar/{id}/delete", name="chill_calendar_calendar_delete")
*/
#[Route(path: '/{_locale}/calendar/{id}/delete', name: 'chill_calendar_calendar_delete')]
public function deleteAction(Request $request, Calendar $entity)
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
[$person, $accompanyingPeriod] = [$entity->getPerson(), $entity->getAccompanyingPeriod()];
@@ -85,7 +84,7 @@ class CalendarController extends AbstractController
$form = $this->createDeleteForm($entity);
if (Request::METHOD_DELETE === $request->getMethod()) {
if (Request::METHOD_POST === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {
@@ -114,9 +113,8 @@ class CalendarController extends AbstractController
/**
* Edit a calendar item.
*
* @Route("/{_locale}/calendar/calendar/{id}/edit", name="chill_calendar_calendar_edit")
*/
#[Route(path: '/{_locale}/calendar/calendar/{id}/edit', name: 'chill_calendar_calendar_edit')]
public function editAction(Calendar $entity, Request $request): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::EDIT, $entity);
@@ -125,7 +123,7 @@ class CalendarController extends AbstractController
return $this->remoteCalendarConnector->getMakeReadyResponse($request->getUri());
}
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
[$person, $accompanyingPeriod] = [$entity->getPerson(), $entity->getAccompanyingPeriod()];
@@ -194,9 +192,8 @@ class CalendarController extends AbstractController
/**
* Lists all Calendar entities.
*
* @Route("/{_locale}/calendar/calendar/by-period/{id}", name="chill_calendar_calendar_list_by_period")
*/
#[Route(path: '/{_locale}/calendar/calendar/by-period/{id}', name: 'chill_calendar_calendar_list_by_period')]
public function listActionByCourse(AccompanyingPeriod $accompanyingPeriod): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $accompanyingPeriod);
@@ -228,9 +225,8 @@ class CalendarController extends AbstractController
/**
* Lists all Calendar entities on a person.
*
* @Route("/{_locale}/calendar/calendar/by-person/{id}", name="chill_calendar_calendar_list_by_person")
*/
#[Route(path: '/{_locale}/calendar/calendar/by-person/{id}', name: 'chill_calendar_calendar_list_by_person')]
public function listActionByPerson(Person $person): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $person);
@@ -260,9 +256,7 @@ class CalendarController extends AbstractController
]);
}
/**
* @Route("/{_locale}/calendar/calendar/my", name="chill_calendar_calendar_list_my")
*/
#[Route(path: '/{_locale}/calendar/calendar/my', name: 'chill_calendar_calendar_list_my')]
public function myCalendar(Request $request): Response
{
$this->denyAccessUnlessGranted('ROLE_USER');
@@ -284,9 +278,8 @@ class CalendarController extends AbstractController
/**
* Create a new calendar item.
*
* @Route("/{_locale}/calendar/calendar/new", name="chill_calendar_calendar_new")
*/
#[Route(path: '/{_locale}/calendar/calendar/new', name: 'chill_calendar_calendar_new')]
public function newAction(Request $request): Response
{
if (!$this->remoteCalendarConnector->isReady()) {
@@ -294,7 +287,7 @@ class CalendarController extends AbstractController
}
$view = null;
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
[$person, $accompanyingPeriod] = $this->getEntity($request);
@@ -385,14 +378,13 @@ class CalendarController extends AbstractController
/**
* Show a calendar item.
*
* @Route("/{_locale}/calendar/calendar/{id}/show", name="chill_calendar_calendar_show")
*/
#[Route(path: '/{_locale}/calendar/calendar/{id}/show', name: 'chill_calendar_calendar_show')]
public function showAction(Request $request, int $id): Response
{
throw new \Exception('not implemented');
$view = null;
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
[$user, $accompanyingPeriod] = $this->getEntity($request);
@@ -455,9 +447,7 @@ class CalendarController extends AbstractController
]);
}
/**
* @Route("/{_locale}/calendar/calendar/{id}/to-activity", name="chill_calendar_calendar_to_activity")
*/
#[Route(path: '/{_locale}/calendar/calendar/{id}/to-activity', name: 'chill_calendar_calendar_to_activity')]
public function toActivity(Request $request, Calendar $calendar): RedirectResponse
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $calendar);
@@ -522,7 +512,6 @@ class CalendarController extends AbstractController
{
return $this->createFormBuilder()
->setAction($this->generateUrl('chill_calendar_calendar_delete', ['id' => $calendar->getId()]))
->setMethod('DELETE')
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm();
}
@@ -532,7 +521,7 @@ class CalendarController extends AbstractController
*/
private function getEntity(Request $request): array
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$person = $accompanyingPeriod = null;
if ($request->query->has('person_id')) {

View File

@@ -35,12 +35,9 @@ final readonly class CalendarDocController
private FormFactoryInterface $formFactory,
private Security $security,
private UrlGeneratorInterface $urlGenerator,
) {
}
) {}
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/new", name="chill_calendar_calendardoc_new")
*/
#[Route(path: '/{_locale}/calendar/calendar-doc/{id}/new', name: 'chill_calendar_calendardoc_new')]
public function create(Calendar $calendar, Request $request): Response
{
$calendarDoc = (new CalendarDoc($calendar, null))->setCalendar($calendar);
@@ -97,9 +94,7 @@ final readonly class CalendarDocController
);
}
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/delete", name="chill_calendar_calendardoc_delete")
*/
#[Route(path: '/{_locale}/calendar/calendar-doc/{id}/delete', name: 'chill_calendar_calendardoc_delete')]
public function delete(CalendarDoc $calendarDoc, Request $request): Response
{
if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) {
@@ -157,9 +152,7 @@ final readonly class CalendarDocController
);
}
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/edit", name="chill_calendar_calendardoc_edit")
*/
#[Route(path: '/{_locale}/calendar/calendar-doc/{id}/edit', name: 'chill_calendar_calendardoc_edit')]
public function edit(CalendarDoc $calendarDoc, Request $request): Response
{
if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) {

View File

@@ -23,16 +23,9 @@ use Symfony\Component\Routing\Annotation\Route;
class CalendarRangeAPIController extends ApiController
{
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository)
{
}
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) {}
/**
* @Route("/api/1.0/calendar/calendar-range-available/{id}.{_format}",
* name="chill_api_single_calendar_range_available",
* requirements={"_format": "json"}
* )
*/
#[Route(path: '/api/1.0/calendar/calendar-range-available/{id}.{_format}', name: 'chill_api_single_calendar_range_available', requirements: ['_format' => 'json'])]
public function availableRanges(User $user, Request $request, string $_format): JsonResponse
{
// return new JsonResponse(['ok' => true], 200, [], false);

View File

@@ -34,15 +34,12 @@ use Symfony\Component\Security\Core\Security;
class InviteApiController
{
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly MessageBusInterface $messageBus, private readonly Security $security) {}
/**
* Give an answer to a calendar invite.
*
* @Route("/api/1.0/calendar/calendar/{id}/answer/{answer}.json", methods={"post"})
*/
#[Route(path: '/api/1.0/calendar/calendar/{id}/answer/{answer}.json', methods: ['post'])]
public function answer(Calendar $calendar, string $answer): Response
{
$user = $this->security->getUser();

View File

@@ -30,13 +30,9 @@ use TheNetworg\OAuth2\Client\Token\AccessToken;
class RemoteCalendarConnectAzureController
{
public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage)
{
}
public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) {}
/**
* @Route("/{_locale}/connect/azure", name="chill_calendar_remote_connect_azure")
*/
#[Route(path: '/{_locale}/connect/azure', name: 'chill_calendar_remote_connect_azure')]
public function connectAzure(Request $request): Response
{
$request->getSession()->set('azure_return_path', $request->query->get('returnPath', '/'));
@@ -46,9 +42,7 @@ class RemoteCalendarConnectAzureController
->redirect(['https://graph.microsoft.com/.default', 'offline_access'], []);
}
/**
* @Route("/connect/azure/check", name="chill_calendar_remote_connect_azure_check")
*/
#[Route(path: '/connect/azure/check', name: 'chill_calendar_remote_connect_azure_check')]
public function connectAzureCheck(Request $request): Response
{
/** @var Azure $client */

View File

@@ -27,14 +27,9 @@ use Symfony\Component\Routing\Annotation\Route;
class RemoteCalendarMSGraphSyncController
{
public function __construct(private readonly MessageBusInterface $messageBus)
{
}
public function __construct(private readonly MessageBusInterface $messageBus) {}
/**
* @Route("/public/incoming-hook/calendar/msgraph/events/{userId}", name="chill_calendar_remote_msgraph_incoming_webhook_events",
* methods={"POST"})
*/
#[Route(path: '/public/incoming-hook/calendar/msgraph/events/{userId}', name: 'chill_calendar_remote_msgraph_incoming_webhook_events', methods: ['POST'])]
public function webhookCalendarReceiver(int $userId, Request $request): Response
{
if ($request->query->has('validationToken')) {

View File

@@ -34,13 +34,9 @@ use Symfony\Component\Serializer\SerializerInterface;
*/
class RemoteCalendarProxyController
{
public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer)
{
}
public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) {}
/**
* @Route("api/1.0/calendar/proxy/calendar/by-user/{id}/events")
*/
#[Route(path: 'api/1.0/calendar/proxy/calendar/by-user/{id}/events')]
public function listEventForCalendar(User $user, Request $request): Response
{
if (!$request->query->has('dateFrom')) {

View File

@@ -28,9 +28,7 @@ class LoadCalendarRange extends Fixture implements FixtureGroupInterface, Ordere
{
public static array $references = [];
public function __construct(private readonly UserRepository $userRepository)
{
}
public function __construct(private readonly UserRepository $userRepository) {}
public static function getGroups(): array
{

View File

@@ -36,18 +36,10 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Mapping\ClassMetadata;
/**
* @ORM\Table(
* name="chill_calendar.calendar",
* uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})}
* )
*
* @ORM\Entity
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "chill_calendar_calendar": Calendar::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_calendar_calendar' => Calendar::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_calendar.calendar')]
#[ORM\UniqueConstraint(name: 'idx_calendar_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])]
class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface
{
use RemoteCalendarTrait;
@@ -89,184 +81,110 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
public ?User $previousMainUser = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars")
*
* @Serializer\Groups({"calendar:read", "read"})
*/
#[Serializer\Groups(['calendar:read', 'read'])]
#[ORM\ManyToOne(targetEntity: AccompanyingPeriod::class, inversedBy: 'calendars')]
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\Activity")
*/
#[ORM\ManyToOne(targetEntity: Activity::class)]
private ?Activity $activity = null;
/**
* @ORM\OneToOne(targetEntity="CalendarRange", inversedBy="calendar")
*
* @Serializer\Groups({"calendar:read", "read"})
*/
#[Serializer\Groups(['calendar:read', 'read'])]
#[ORM\OneToOne(targetEntity: CalendarRange::class, inversedBy: 'calendar')]
private ?CalendarRange $calendarRange = null;
/**
* @ORM\ManyToOne(targetEntity="CancelReason")
*/
#[ORM\ManyToOne(targetEntity: CancelReason::class)]
private ?CancelReason $cancelReason = null;
/**
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
*
* @Serializer\Groups({"calendar:read", "read", "docgen:read"})
*/
#[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])]
#[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')]
private CommentEmbeddable $comment;
/**
* @ORM\Column(type="integer", nullable=false, options={"default": 0})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 0])]
private int $dateTimeVersion = 0;
/**
* @var Collection<CalendarDoc>
*
* @ORM\OneToMany(targetEntity=CalendarDoc::class, mappedBy="calendar", orphanRemoval=true)
* @var Collection<int, \Chill\CalendarBundle\Entity\CalendarDoc>
*/
#[ORM\OneToMany(mappedBy: 'calendar', targetEntity: CalendarDoc::class, orphanRemoval: true)]
private Collection $documents;
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Assert\NotNull(message="calendar.An end date is required")
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.An end date is required')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\OneToMany(
* targetEntity=Invite::class,
* mappedBy="calendar",
* orphanRemoval=true,
* cascade={"persist", "remove", "merge", "detach"}
* )
*
* @ORM\JoinTable(name="chill_calendar.calendar_to_invites")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @var Collection&Selectable<int, Invite>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\CalendarBundle\Entity\Invite>&Selectable
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(mappedBy: 'calendar', targetEntity: Invite::class, cascade: ['persist', 'remove', 'merge', 'detach'], orphanRemoval: true)]
#[ORM\JoinTable(name: 'chill_calendar.calendar_to_invites')]
private Collection&Selectable $invites;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Assert\NotNull(message="calendar.A location is required")
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.A location is required')]
#[ORM\ManyToOne(targetEntity: Location::class)]
private ?Location $location = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*
* @Assert\NotNull(message="calendar.A main user is mandatory")
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.A main user is mandatory')]
#[ORM\ManyToOne(targetEntity: User::class)]
#[Serializer\Context(normalizationContext: ['read'], groups: ['calendar:light'])]
private ?User $mainUser = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=true)
*/
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Person $person = null;
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person", inversedBy="calendars")
*
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*
* @Assert\Count(min=1, minMessage="calendar.At least {{ limit }} person is required.")
*
* @var Collection<Person>
* @var Collection<int, Person>
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\Count(min: 1, minMessage: 'calendar.At least {{ limit }} person is required.')]
#[ORM\ManyToMany(targetEntity: Person::class, inversedBy: 'calendars')]
#[ORM\JoinTable(name: 'chill_calendar.calendar_to_persons')]
#[Serializer\Context(normalizationContext: ['read'], groups: ['calendar:light'])]
private Collection $persons;
/**
* @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_")
*
* @Serializer\Groups({"calendar:read"})
*/
#[Serializer\Groups(['calendar:read'])]
#[ORM\Embedded(class: PrivateCommentEmbeddable::class, columnPrefix: 'privateComment_')]
private PrivateCommentEmbeddable $privateComment;
/**
* @var Collection<ThirdParty>
*
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
*
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
* @var Collection<int, ThirdParty>
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: ThirdParty::class)]
#[ORM\JoinTable(name: 'chill_calendar.calendar_to_thirdparties')]
#[Serializer\Context(normalizationContext: ['read'], groups: ['calendar:light'])]
private Collection $professionals;
/**
* @ORM\Column(type="boolean", nullable=true)
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)]
private ?bool $sendSMS = false;
/**
* @ORM\Column(type="text", nullable=false, options={"default": Calendar::SMS_PENDING})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => Calendar::SMS_PENDING])]
private string $smsStatus = self::SMS_PENDING;
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*
* @Assert\NotNull(message="calendar.A start date is required")
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.A start date is required')]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
#[Serializer\Context(normalizationContext: ['read'], groups: ['calendar:light'])]
private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="string", length=255, nullable=false, options={"default": "valid"})
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: false, options: ['default' => 'valid'])]
#[Serializer\Context(normalizationContext: ['read'], groups: ['calendar:light'])]
private string $status = self::STATUS_VALID;
/**
* @ORM\Column(type="boolean", nullable=true)
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)]
private ?bool $urgent = false;
public function __construct()
@@ -394,9 +312,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
return $this->documents;
}
/**
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
public function getDuration(): ?\DateInterval
{
if (null === $this->getStartDate() || null === $this->getEndDate()) {
@@ -551,9 +467,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
/**
* @return ReadableCollection<(int|string), User>
*
* @Serializer\Groups({"calendar:read", "read"})
*/
#[Serializer\Groups(['calendar:read', 'read'])]
public function getUsers(): ReadableCollection
{
return $this->getInvites()->map(static fn (Invite $i) => $i->getUser());

View File

@@ -20,52 +20,35 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="chill_calendar.calendar_doc",
* )
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_calendar.calendar_doc')]
class CalendarDoc implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
use TrackUpdateTrait;
/**
* @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="documents")
*
* @ORM\JoinColumn(nullable=false)
*/
#[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'documents')]
#[ORM\JoinColumn(nullable: false)]
private Calendar $calendar;
/**
* @ORM\Column(type="integer", nullable=false, options={"default": 0})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false, options: ['default' => 0])]
private int $datetimeVersion = 0;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default": false})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: false, options: ['default' => false])]
private bool $trackDateTimeVersion = false;
public function __construct(Calendar $calendar, /**
* @ORM\ManyToOne(targetEntity=StoredObject::class, cascade={"persist"})
*
* @ORM\JoinColumn(nullable=false)
*/
private ?StoredObject $storedObject)
{
public function __construct(
Calendar $calendar,
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
#[ORM\JoinColumn(nullable: false)]
private ?StoredObject $storedObject,
) {
$this->setCalendar($calendar);
$this->datetimeVersion = $calendar->getDateTimeVersion();
}

View File

@@ -16,17 +16,11 @@ use Symfony\Component\Validator\Constraints as Assert;
class CalendarDocCreateDTO
{
/**
* @Assert\NotNull
*
* @Assert\Valid
*/
#[Assert\NotNull]
#[Assert\Valid]
public ?StoredObject $doc = null;
/**
* @Assert\NotBlank
*
* @Assert\NotNull
*/
#[Assert\NotBlank]
#[Assert\NotNull]
public ?string $title = '';
}

View File

@@ -17,16 +17,11 @@ use Symfony\Component\Validator\Constraints as Assert;
class CalendarDocEditDTO
{
/**
* @Assert\Valid
*/
#[Assert\Valid]
public ?StoredObject $doc = null;
/**
* @Assert\NotBlank
*
* @Assert\NotNull
*/
#[Assert\NotBlank]
#[Assert\NotNull]
public ?string $title = '';
public function __construct(CalendarDoc $calendarDoc)

View File

@@ -21,14 +21,9 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table(
* name="chill_calendar.calendar_range",
* uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_range_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})}
* )
*
* @ORM\Entity
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_calendar.calendar_range')]
#[ORM\UniqueConstraint(name: 'idx_calendar_range_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])]
class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
{
use RemoteCalendarTrait;
@@ -37,58 +32,34 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
use TrackUpdateTrait;
/**
* @ORM\OneToOne(targetEntity=Calendar::class, mappedBy="calendarRange")
*/
#[ORM\OneToOne(targetEntity: Calendar::class, mappedBy: 'calendarRange')]
private ?Calendar $calendar = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*
* @Groups({"read", "write", "calendar:read"})
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $endDate = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Groups({"read"})
*/
#[Groups(['read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Location::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Groups({"read", "write", "calendar:read"})
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: Location::class)]
#[ORM\JoinColumn(nullable: false)]
private ?Location $location = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*
* @groups({"read", "write", "calendar:read"})
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)]
private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @Groups({"read", "write", "calendar:read"})
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $user = null;
public function getCalendar(): ?Calendar

View File

@@ -14,11 +14,8 @@ namespace Chill\CalendarBundle\Entity;
use Chill\CalendarBundle\Repository\CancelReasonRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="chill_calendar.cancel_reason")
*
* @ORM\Entity(repositoryClass=CancelReasonRepository::class)
*/
#[ORM\Entity(repositoryClass: CancelReasonRepository::class)]
#[ORM\Table(name: 'chill_calendar.cancel_reason')]
class CancelReason
{
final public const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT';
@@ -27,28 +24,18 @@ class CancelReason
final public const CANCELEDBY_USER = 'CANCELEDBY_USER';
/**
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private ?bool $active = null;
/**
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private ?string $canceledBy = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
private array $name = [];
public function getActive(): ?bool

View File

@@ -24,14 +24,10 @@ use Symfony\Component\Serializer\Annotation as Serializer;
*
* The event/calendar in the user may have a different id than the mainUser. We add then fields to store the
* remote id of this event in the remote calendar.
*
* @ORM\Table(
* name="chill_calendar.invite",
* uniqueConstraints={@ORM\UniqueConstraint(name="idx_calendar_invite_remote", columns={"remoteId"}, options={"where": "remoteId <> ''"})}
* )
*
* @ORM\Entity
*/
#[ORM\Entity]
#[ORM\Table(name: 'chill_calendar.invite')]
#[ORM\UniqueConstraint(name: 'idx_calendar_invite_remote', columns: ['remoteId'], options: ['where' => "remoteId <> ''"])]
class Invite implements TrackUpdateInterface, TrackCreationInterface
{
use RemoteCalendarTrait;
@@ -58,36 +54,22 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
final public const TENTATIVELY_ACCEPTED = 'tentative';
/**
* @ORM\ManyToOne(targetEntity=Calendar::class, inversedBy="invites")
*/
#[ORM\ManyToOne(targetEntity: Calendar::class, inversedBy: 'invites')]
private ?Calendar $calendar = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups(groups={"calendar:read", "read"})
*/
#[Serializer\Groups(groups: ['calendar:read', 'read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": "pending"})
*
* @Serializer\Groups(groups={"calendar:read", "read", "docgen:read"})
*/
#[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => 'pending'])]
private string $status = self::PENDING;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @ORM\JoinColumn(nullable=false)
*
* @Serializer\Groups(groups={"calendar:read", "read", "docgen:read"})
*/
#[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: false)]
private ?User $user = null;
public function getCalendar(): ?Calendar

View File

@@ -30,14 +30,10 @@ trait RemoteCalendarTrait
*/
public bool $preventEnqueueChanges = false;
/**
* @ORM\Column(type="json", options={"default": "[]"}, nullable=false)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]'], nullable: false)]
private array $remoteAttributes = [];
/**
* @ORM\Column(type="text", options={"default": ""}, nullable=false)
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''], nullable: false)]
private string $remoteId = '';
public function addRemoteAttributes(array $remoteAttributes): self

View File

@@ -17,9 +17,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
class ListenToActivityCreate
{
public function __construct(private readonly RequestStack $requestStack)
{
}
public function __construct(private readonly RequestStack $requestStack) {}
public function postPersist(Activity $activity, LifecycleEventArgs $event): void
{
@@ -31,7 +29,7 @@ class ListenToActivityCreate
}
if ($request->query->has('activityData')) {
$activityData = $request->query->get('activityData');
$activityData = $request->query->all('activityData');
if (\array_key_exists('calendarId', $activityData)) {
$calendarId = $activityData['calendarId'];

View File

@@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface;
final readonly class AgentAggregator implements AggregatorInterface
{
public function __construct(private UserRepository $userRepository, private UserRender $userRender)
{
}
public function __construct(private UserRepository $userRepository, private UserRender $userRender) {}
public function addRole(): ?string
{

View File

@@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class CancelReasonAggregator implements AggregatorInterface
{
public function __construct(private readonly CancelReasonRepository $cancelReasonRepository, private readonly TranslatableStringHelper $translatableStringHelper)
{
}
public function __construct(private readonly CancelReasonRepository $cancelReasonRepository, private readonly TranslatableStringHelper $translatableStringHelper) {}
public function addRole(): ?string
{

View File

@@ -27,8 +27,7 @@ final readonly class JobAggregator implements AggregatorInterface
public function __construct(
private UserJobRepository $jobRepository,
private TranslatableStringHelper $translatableStringHelper,
) {
}
) {}
public function addRole(): ?string
{
@@ -66,9 +65,7 @@ final readonly class JobAggregator implements AggregatorInterface
return Declarations::CALENDAR_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
}
public function buildForm(FormBuilderInterface $builder) {}
public function getFormDefaultData(): array
{

View File

@@ -19,9 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface;
final readonly class LocationAggregator implements AggregatorInterface
{
public function __construct(private LocationRepository $locationRepository)
{
}
public function __construct(private LocationRepository $locationRepository) {}
public function addRole(): ?string
{

View File

@@ -20,9 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface;
final readonly class LocationTypeAggregator implements AggregatorInterface
{
public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper) {}
public function addRole(): ?string
{

View File

@@ -27,8 +27,7 @@ final readonly class ScopeAggregator implements AggregatorInterface
public function __construct(
private ScopeRepository $scopeRepository,
private TranslatableStringHelper $translatableStringHelper,
) {
}
) {}
public function addRole(): ?string
{
@@ -66,9 +65,7 @@ final readonly class ScopeAggregator implements AggregatorInterface
return Declarations::CALENDAR_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
}
public function buildForm(FormBuilderInterface $builder) {}
public function getFormDefaultData(): array
{

View File

@@ -26,9 +26,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class UrgencyAggregator implements AggregatorInterface
{
public function __construct(private readonly TranslatorInterface $translator)
{
}
public function __construct(private readonly TranslatorInterface $translator) {}
public function addRole(): ?string
{

View File

@@ -27,8 +27,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
{
public function __construct(
private readonly CalendarRepository $calendarRepository,
) {
}
) {}
public function buildForm(FormBuilderInterface $builder)
{

View File

@@ -24,9 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private readonly CalendarRepository $calendarRepository)
{
}
public function __construct(private readonly CalendarRepository $calendarRepository) {}
public function buildForm(FormBuilderInterface $builder): void
{

View File

@@ -24,9 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private readonly CalendarRepository $calendarRepository)
{
}
public function __construct(private readonly CalendarRepository $calendarRepository) {}
public function buildForm(FormBuilderInterface $builder): void
{

View File

@@ -22,9 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class AgentFilter implements FilterInterface
{
public function __construct(private readonly UserRender $userRender)
{
}
public function __construct(private readonly UserRender $userRender) {}
public function addRole(): ?string
{

View File

@@ -21,9 +21,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class BetweenDatesFilter implements FilterInterface
{
public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter)
{
}
public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter) {}
public function addRole(): ?string
{

View File

@@ -34,9 +34,7 @@ class CalendarRangeFilter implements FilterInterface
private const DEFAULT_CHOICE = 'false';
public function __construct(private readonly TranslatorInterface $translator)
{
}
public function __construct(private readonly TranslatorInterface $translator) {}
public function addRole(): ?string
{

View File

@@ -29,8 +29,7 @@ final readonly class JobFilter implements FilterInterface
public function __construct(
private TranslatableStringHelper $translatableStringHelper,
private UserJobRepositoryInterface $userJobRepository,
) {
}
) {}
public function addRole(): ?string
{

View File

@@ -31,8 +31,7 @@ class ScopeFilter implements FilterInterface
protected TranslatorInterface $translator,
private readonly TranslatableStringHelper $translatableStringHelper,
private readonly ScopeRepositoryInterface $scopeRepository,
) {
}
) {}
public function addRole(): ?string
{

View File

@@ -38,8 +38,7 @@ class CalendarType extends AbstractType
private readonly IdToLocationDataTransformer $idToLocationDataTransformer,
private readonly ThirdPartiesToIdDataTransformer $partiesToIdDataTransformer,
private readonly IdToCalendarRangeDataTransformer $calendarRangeDataTransformer,
) {
}
) {}
public function buildForm(FormBuilderInterface $builder, array $options)
{

View File

@@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
{
public function __construct(private readonly Security $security, protected TranslatorInterface $translator)
{
}
public function __construct(private readonly Security $security, protected TranslatorInterface $translator) {}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{

View File

@@ -18,9 +18,7 @@ use Symfony\Component\Security\Core\Security;
final readonly class AccompanyingCourseQuickMenuBuilder implements LocalMenuBuilderInterface
{
public function __construct(private Security $security)
{
}
public function __construct(private Security $security) {}
public static function getMenuIds(): array
{

View File

@@ -19,9 +19,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class PersonMenuBuilder implements LocalMenuBuilderInterface
{
public function __construct(private readonly Security $security, protected TranslatorInterface $translator)
{
}
public function __construct(private readonly Security $security, protected TranslatorInterface $translator) {}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{

View File

@@ -18,9 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class UserMenuBuilder implements LocalMenuBuilderInterface
{
public function __construct(private readonly Security $security, public TranslatorInterface $translator)
{
}
public function __construct(private readonly Security $security, public TranslatorInterface $translator) {}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{

View File

@@ -29,9 +29,7 @@ use Symfony\Component\Security\Core\Security;
class CalendarEntityListener
{
public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security)
{
}
public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) {}
public function postPersist(Calendar $calendar, PostPersistEventArgs $args): void
{

View File

@@ -29,9 +29,7 @@ use Symfony\Component\Security\Core\Security;
class CalendarRangeEntityListener
{
public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security)
{
}
public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) {}
public function postPersist(CalendarRange $calendarRange, PostPersistEventArgs $eventArgs): void
{

View File

@@ -31,9 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class CalendarRangeRemoveToRemoteHandler implements MessageHandlerInterface
{
public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly UserRepository $userRepository)
{
}
public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly UserRepository $userRepository) {}
public function __invoke(CalendarRangeRemovedMessage $calendarRangeRemovedMessage)
{

View File

@@ -32,9 +32,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class CalendarRangeToRemoteHandler implements MessageHandlerInterface
{
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly EntityManagerInterface $entityManager) {}
public function __invoke(CalendarRangeMessage $calendarRangeMessage): void
{

View File

@@ -31,9 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class CalendarRemoveHandler implements MessageHandlerInterface
{
public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly UserRepositoryInterface $userRepository)
{
}
public function __construct(private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly UserRepositoryInterface $userRepository) {}
public function __invoke(CalendarRemovedMessage $message)
{

View File

@@ -37,9 +37,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class CalendarToRemoteHandler implements MessageHandlerInterface
{
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $entityManager, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $calendarConnector, private readonly UserRepository $userRepository)
{
}
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $entityManager, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $calendarConnector, private readonly UserRepository $userRepository) {}
public function __invoke(CalendarMessage $calendarMessage)
{

View File

@@ -31,9 +31,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class InviteUpdateHandler implements MessageHandlerInterface
{
public function __construct(private readonly EntityManagerInterface $em, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector)
{
}
public function __construct(private readonly EntityManagerInterface $em, private readonly InviteRepository $inviteRepository, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector) {}
public function __invoke(InviteUpdateMessage $inviteUpdateMessage): void
{

View File

@@ -36,9 +36,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
*/
class MSGraphChangeNotificationHandler implements MessageHandlerInterface
{
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRangeSyncer $calendarRangeSyncer, private readonly CalendarRepository $calendarRepository, private readonly CalendarSyncer $calendarSyncer, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UserRepository $userRepository)
{
}
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, private readonly CalendarRangeSyncer $calendarRangeSyncer, private readonly CalendarRepository $calendarRepository, private readonly CalendarSyncer $calendarSyncer, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UserRepository $userRepository) {}
public function __invoke(MSGraphChangeNotificationMessage $changeNotificationMessage): void
{

View File

@@ -20,9 +20,7 @@ namespace Chill\CalendarBundle\Messenger\Message;
class MSGraphChangeNotificationMessage
{
public function __construct(private readonly array $content, private readonly int $userId)
{
}
public function __construct(private readonly array $content, private readonly int $userId) {}
public function getContent(): array
{

View File

@@ -24,9 +24,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
class AddressConverter
{
public function __construct(private readonly AddressRender $addressRender, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}
public function __construct(private readonly AddressRender $addressRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) {}
public function addressToRemote(Address $address): array
{

View File

@@ -28,9 +28,7 @@ use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
*/
class EventsOnUserSubscriptionCreator
{
public function __construct(private readonly LoggerInterface $logger, private readonly MachineHttpClient $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UrlGeneratorInterface $urlGenerator)
{
}
public function __construct(private readonly LoggerInterface $logger, private readonly MachineHttpClient $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly UrlGeneratorInterface $urlGenerator) {}
/**
* @return array{secret: string, id: string, expiration: int}

View File

@@ -22,9 +22,7 @@ use Chill\MainBundle\Entity\Location;
class LocationConverter
{
public function __construct(private readonly AddressConverter $addressConverter)
{
}
public function __construct(private readonly AddressConverter $addressConverter) {}
public function locationToRemote(Location $location): array
{

View File

@@ -27,8 +27,7 @@ final readonly class MSUserAbsenceReader implements MSUserAbsenceReaderInterface
private HttpClientInterface $machineHttpClient,
private MapCalendarToUser $mapCalendarToUser,
private ClockInterface $clock,
) {
}
) {}
/**
* @throw UserAbsenceSyncException when the data cannot be reached or is not valid from microsoft

View File

@@ -21,8 +21,7 @@ readonly class MSUserAbsenceSync
private MSUserAbsenceReaderInterface $absenceReader,
private ClockInterface $clock,
private LoggerInterface $logger,
) {
}
) {}
public function syncUserAbsence(User $user): void
{

View File

@@ -29,9 +29,7 @@ class MachineTokenStorage
private ?AccessTokenInterface $accessToken = null;
public function __construct(private readonly Azure $azure, private readonly ChillRedis $chillRedis)
{
}
public function __construct(private readonly Azure $azure, private readonly ChillRedis $chillRedis) {}
public function getToken(): AccessTokenInterface
{

View File

@@ -36,9 +36,7 @@ class MapCalendarToUser
final public const SECRET_SUBSCRIPTION_EVENT = 'subscription_events_secret';
public function __construct(private readonly HttpClientInterface $machineHttpClient, private readonly LoggerInterface $logger)
{
}
public function __construct(private readonly HttpClientInterface $machineHttpClient, private readonly LoggerInterface $logger) {}
public function getActiveSubscriptionId(User $user): string
{

View File

@@ -29,9 +29,7 @@ class OnBehalfOfUserTokenStorage
{
final public const MS_GRAPH_ACCESS_TOKEN = 'msgraph_access_token';
public function __construct(private readonly Azure $azure, private readonly SessionInterface $session)
{
}
public function __construct(private readonly Azure $azure, private readonly SessionInterface $session) {}
public function getToken(): AccessToken
{

View File

@@ -32,9 +32,7 @@ class CalendarRangeSyncer
/**
* @param MachineHttpClient $machineHttpClient
*/
public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient)
{
}
public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient) {}
public function handleCalendarRangeSync(CalendarRange $calendarRange, array $notification, User $user): void
{

View File

@@ -29,9 +29,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
class CalendarSyncer
{
public function __construct(private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient, private readonly UserRepositoryInterface $userRepository)
{
}
public function __construct(private readonly LoggerInterface $logger, private readonly HttpClientInterface $machineHttpClient, private readonly UserRepositoryInterface $userRepository) {}
public function handleCalendarSync(Calendar $calendar, array $notification, User $user): void
{

View File

@@ -41,9 +41,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
{
private array $cacheScheduleTimeForUser = [];
public function __construct(private readonly CalendarRepository $calendarRepository, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly HttpClientInterface $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly LoggerInterface $logger, private readonly OnBehalfOfUserTokenStorage $tokenStorage, private readonly OnBehalfOfUserHttpClient $userHttpClient, private readonly RemoteEventConverter $remoteEventConverter, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator, private readonly Security $security)
{
}
public function __construct(private readonly CalendarRepository $calendarRepository, private readonly CalendarRangeRepository $calendarRangeRepository, private readonly HttpClientInterface $machineHttpClient, private readonly MapCalendarToUser $mapCalendarToUser, private readonly LoggerInterface $logger, private readonly OnBehalfOfUserTokenStorage $tokenStorage, private readonly OnBehalfOfUserHttpClient $userHttpClient, private readonly RemoteEventConverter $remoteEventConverter, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator, private readonly Security $security) {}
public function countEventsForUser(User $user, \DateTimeImmutable $startDate, \DateTimeImmutable $endDate): int
{

View File

@@ -46,23 +46,13 @@ class NullRemoteCalendarConnector implements RemoteCalendarConnectorInterface
return [];
}
public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, ?CalendarRange $associatedCalendarRange = null): void
{
}
public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, ?CalendarRange $associatedCalendarRange = null): void {}
public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void
{
}
public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void {}
public function syncCalendar(Calendar $calendar, string $action, ?CalendarRange $previousCalendarRange, ?User $previousMainUser, ?array $oldInvites, ?array $newInvites): void
{
}
public function syncCalendar(Calendar $calendar, string $action, ?CalendarRange $previousCalendarRange, ?User $previousMainUser, ?array $oldInvites, ?array $newInvites): void {}
public function syncCalendarRange(CalendarRange $calendarRange): void
{
}
public function syncCalendarRange(CalendarRange $calendarRange): void {}
public function syncInvite(Invite $invite): void
{
}
public function syncInvite(Invite $invite): void {}
}

View File

@@ -23,27 +23,16 @@ use Symfony\Component\Serializer\Annotation as Serializer;
class RemoteEvent
{
public function __construct(
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public string $id,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public string $title,
public string $description,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public \DateTimeImmutable $startDate,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public \DateTimeImmutable $endDate,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public bool $isAllDay = false,
) {
}
) {}
}

View File

@@ -28,9 +28,7 @@ use Doctrine\ORM\QueryBuilder;
class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface
{
public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EntityManagerInterface $em)
{
}
public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EntityManagerInterface $em) {}
public function buildQueryByAccompanyingPeriod(AccompanyingPeriod $period, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate): QueryBuilder
{

View File

@@ -16,7 +16,7 @@
:removableIfSet="false"
:displayPicked="false"
:suggested="this.suggestedUsers"
:label="'Utilisateur principal'"
:label="'main_user'"
@addNewEntity="setMainUser"
></pick-entity>
</div>

View File

@@ -19,6 +19,7 @@ const appMessages = {
change_main_user_will_reset_event_data: "Modifier l'utilisateur principal nécessite de choisir une autre plage de disponibilité ou un autre horaire. Ces informations seront perdues. Êtes-vous sûr·e de vouloir continuer ?",
list_three_days: 'Liste 3 jours',
current_selected: 'Rendez-vous fixé',
main_user: "Utilisateur principal",
}
}

View File

@@ -151,7 +151,7 @@
<div class="item-row separator">
<ul class="record_actions">
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', calendar) %}
{% if is_granted('CHILL_CALENDAR_DOC_EDIT', calendar) %}
{% if templates|length == 0 %}
<li>
<a class="btn btn-create"
@@ -213,24 +213,18 @@
class="btn btn-show "></a>
</li>
{% endif %}
{# TOOD
{% if is_granted('CHILL_ACTIVITY_UPDATE', calendar) %}
#}
{% if is_granted('CHILL_CALENDAR_CALENDAR_EDIT', calendar) %}
<li>
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_edit', { 'id': calendar.id }) }}"
class="btn btn-update "></a>
</li>
{# TOOD
{% endif %}
{% if is_granted('CHILL_ACTIVITY_DELETE', calendar) %}
#}
{% if is_granted('CHILL_CALENDAR_CALENDAR_DELETE', calendar) %}
<li>
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_delete', { 'id': calendar.id } ) }}"
class="btn btn-delete "></a>
</li>
{#
{% endif %}
#}
</ul>
</div>

View File

@@ -11,9 +11,11 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\Security\Voter;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Entity\CalendarDoc;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use Symfony\Component\Security\Core\Exception\LogicException;
use Symfony\Component\Security\Core\Security;
class CalendarDocVoter extends Voter
@@ -27,24 +29,29 @@ class CalendarDocVoter extends Voter
'CHILL_CALENDAR_DOC_SEE',
];
public function __construct(private readonly Security $security)
{
}
public function __construct(private readonly Security $security) {}
protected function supports($attribute, $subject): bool
{
return \in_array($attribute, self::ALL, true) && $subject instanceof CalendarDoc;
return \in_array($attribute, self::ALL, true) && ($subject instanceof CalendarDoc || $subject instanceof Calendar);
}
/**
* @param CalendarDoc $subject
*/
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
{
return match ($attribute) {
self::EDIT => $this->security->isGranted(CalendarVoter::EDIT, $subject->getCalendar()),
self::SEE => $this->security->isGranted(CalendarVoter::SEE, $subject->getCalendar()),
default => throw new \UnexpectedValueException('Attribute not supported: '.$attribute),
};
if ($subject instanceof Calendar) {
return match ($attribute) {
self::EDIT => $this->security->isGranted(CalendarVoter::EDIT, $subject),
self::SEE => $this->security->isGranted(CalendarVoter::SEE, $subject),
default => throw new LogicException('attribute not supported for this Voter'),
};
} elseif ($subject instanceof CalendarDoc) {
return match ($attribute) {
self::EDIT => $this->security->isGranted(CalendarVoter::EDIT, $subject->getCalendar()),
self::SEE => $this->security->isGranted(CalendarVoter::SEE, $subject->getCalendar()),
default => throw new \UnexpectedValueException('Attribute not supported: '.$attribute),
};
}
throw new LogicException('Subject not supported for this Voter');
}
}

View File

@@ -41,8 +41,7 @@ final readonly class CalendarContext implements CalendarContextInterface
private ThirdPartyRender $thirdPartyRender,
private ThirdPartyRepository $thirdPartyRepository,
private TranslatableStringHelperInterface $translatableStringHelper,
) {
}
) {}
public function adminFormReverseTransform(array $data): array
{

View File

@@ -19,6 +19,4 @@ use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
* @extends DocGeneratorContextWithPublicFormInterface<Calendar>
* @extends DocGeneratorContextWithAdminFormInterface<Calendar>
*/
interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface
{
}
interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface {}

View File

@@ -38,8 +38,7 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen
public function __construct(
private Security $security,
private EntityManagerInterface $em,
) {
}
) {}
/**
* @throws MappingException

View File

@@ -37,8 +37,7 @@ final readonly class PersonCalendarGenericDocProvider implements GenericDocForPe
public function __construct(
private Security $security,
private EntityManagerInterface $em,
) {
}
) {}
private function addWhereClausesToQuery(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery
{

View File

@@ -19,9 +19,7 @@ use Chill\DocStoreBundle\GenericDoc\Twig\GenericDocRendererInterface;
final readonly class AccompanyingPeriodCalendarGenericDocRenderer implements GenericDocRendererInterface
{
public function __construct(private CalendarDocRepository $repository)
{
}
public function __construct(private CalendarDocRepository $repository) {}
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
{

View File

@@ -25,9 +25,7 @@ use Symfony\Component\Messenger\MessageBusInterface;
class BulkCalendarShortMessageSender
{
public function __construct(private readonly CalendarForShortMessageProvider $provider, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MessageBusInterface $messageBus, private readonly ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder)
{
}
public function __construct(private readonly CalendarForShortMessageProvider $provider, private readonly EntityManagerInterface $em, private readonly LoggerInterface $logger, private readonly MessageBusInterface $messageBus, private readonly ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder) {}
public function sendBulkMessageToEligibleCalendars()
{

View File

@@ -24,9 +24,7 @@ use Doctrine\ORM\EntityManagerInterface;
class CalendarForShortMessageProvider
{
public function __construct(private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $em, private readonly RangeGeneratorInterface $rangeGenerator)
{
}
public function __construct(private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $em, private readonly RangeGeneratorInterface $rangeGenerator) {}
/**
* Generate calendars instance.

View File

@@ -23,9 +23,7 @@ use Chill\MainBundle\Service\ShortMessage\ShortMessage;
class DefaultShortMessageForCalendarBuilder implements ShortMessageForCalendarBuilderInterface
{
public function __construct(private readonly \Twig\Environment $engine)
{
}
public function __construct(private readonly \Twig\Environment $engine) {}
public function buildMessageForCalendar(Calendar $calendar): array
{

View File

@@ -42,10 +42,10 @@ final class CalendarControllerTest extends WebTestCase
self::ensureKernelShutdown();
}
public function provideAccompanyingPeriod(): iterable
public static function provideAccompanyingPeriod(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$nb = $em->createQueryBuilder()
->from(AccompanyingPeriod::class, 'ac')

View File

@@ -70,7 +70,7 @@ final class RemoteCalendarMSGraphSyncControllerTest extends WebTestCase
$this->assertResponseStatusCodeSame(202);
/** @var InMemoryTransport $transport */
$transport = self::$container->get('messenger.transport.async');
$transport = self::getContainer()->get('messenger.transport.async');
$this->assertCount(1, $transport->getSent());
}

View File

@@ -36,7 +36,7 @@ final class AgentAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.agent_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.agent_aggregator');
}
public function getAggregator()
@@ -44,18 +44,17 @@ final class AgentAggregatorTest extends AbstractAggregatorTest
return $this->aggregator;
}
public function getFormData(): array
public static function getFormData(): array
{
return [
[],
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class CancelReasonAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.cancel_reason_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.cancel_reason_aggregator');
}
public function getAggregator()
@@ -44,18 +44,17 @@ final class CancelReasonAggregatorTest extends AbstractAggregatorTest
return $this->aggregator;
}
public function getFormData(): array
public static function getFormData(): array
{
return [
[],
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.job_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.job_aggregator');
}
public function getAggregator()
@@ -44,18 +44,17 @@ final class JobAggregatorTest extends AbstractAggregatorTest
return $this->aggregator;
}
public function getFormData(): array
public static function getFormData(): array
{
return [
[],
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class LocationAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.location_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.location_aggregator');
}
public function getAggregator()
@@ -44,18 +44,17 @@ final class LocationAggregatorTest extends AbstractAggregatorTest
return $this->aggregator;
}
public function getFormData(): array
public static function getFormData(): array
{
return [
[],
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.location_type_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.location_type_aggregator');
}
public function getAggregator()
@@ -44,18 +44,17 @@ final class LocationTypeAggregatorTest extends AbstractAggregatorTest
return $this->aggregator;
}
public function getFormData(): array
public static function getFormData(): array
{
return [
[],
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class MonthYearAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.month_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.month_aggregator');
}
public function getAggregator()
@@ -44,18 +44,17 @@ final class MonthYearAggregatorTest extends AbstractAggregatorTest
return $this->aggregator;
}
public function getFormData(): array
public static function getFormData(): array
{
return [
[],
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -36,7 +36,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.calendar.export.scope_aggregator');
$this->aggregator = self::getContainer()->get('chill.calendar.export.scope_aggregator');
}
public function getAggregator()
@@ -44,18 +44,17 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
return $this->aggregator;
}
public function getFormData(): array
public static function getFormData(): array
{
return [
[],
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -43,7 +43,7 @@ final class AgentFilterTest extends AbstractFilterTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$this->filter = self::$container->get('chill.calendar.export.agent_filter');
$this->filter = self::getContainer()->get('chill.calendar.export.agent_filter');
}
public function getFilter()
@@ -51,39 +51,34 @@ final class AgentFilterTest extends AbstractFilterTest
return $this->filter;
}
public function getFormData(): iterable
public static function getFormData(): array
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$array = $em->createQueryBuilder()
->from(User::class, 'u')
->select('u')
->getQuery()
->getResult();
$data = [];
foreach ($array as $a) {
yield [
$data[] = [
'accepted_agents' => $a,
];
}
self::ensureKernelShutdown();
return $data;
}
public function getQueryBuilders(): iterable
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
yield $em->createQueryBuilder()
->select('cal.id')
->from(Calendar::class, 'cal')
;
self::ensureKernelShutdown();
}
}

View File

@@ -43,7 +43,7 @@ final class BetweenDatesFilterTest extends AbstractFilterTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$this->filter = self::$container->get('chill.calendar.export.between_dates_filter');
$this->filter = self::getContainer()->get('chill.calendar.export.between_dates_filter');
}
public function getFilter()
@@ -51,7 +51,7 @@ final class BetweenDatesFilterTest extends AbstractFilterTest
return $this->filter;
}
public function getFormData(): array
public static function getFormData(): array
{
return [
[
@@ -61,11 +61,10 @@ final class BetweenDatesFilterTest extends AbstractFilterTest
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -44,7 +44,7 @@ final class JobFilterTest extends AbstractFilterTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$this->filter = self::$container->get('chill.calendar.export.job_filter');
$this->filter = self::getContainer()->get('chill.calendar.export.job_filter');
}
public function getFilter()
@@ -52,11 +52,10 @@ final class JobFilterTest extends AbstractFilterTest
return $this->filter;
}
public function getFormData(): iterable
public static function getFormData(): array
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$array = $em->createQueryBuilder()
->from(UserJob::class, 'uj')
->select('uj')
@@ -71,11 +70,10 @@ final class JobFilterTest extends AbstractFilterTest
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -44,7 +44,7 @@ final class ScopeFilterTest extends AbstractFilterTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$this->filter = self::$container->get('chill.calendar.export.scope_filter');
$this->filter = self::getContainer()->get('chill.calendar.export.scope_filter');
}
public function getFilter()
@@ -52,11 +52,10 @@ final class ScopeFilterTest extends AbstractFilterTest
return $this->filter;
}
public function getFormData(): array
public static function getFormData(): array
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$array = $em->createQueryBuilder()
->from(Scope::class, 's')
->select('s')
@@ -71,11 +70,10 @@ final class ScopeFilterTest extends AbstractFilterTest
];
}
public function getQueryBuilders(): array
public static function getQueryBuilders(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -59,7 +59,7 @@ class MSUserAbsenceReaderTest extends TestCase
self::assertNull($absenceReader->isUserAbsent($user), 'when no user found, absence should be null');
}
public function provideDataTestUserAbsence(): iterable
public static function provideDataTestUserAbsence(): iterable
{
// contains data that was retrieved from microsoft graph api on 2023-07-06

View File

@@ -46,7 +46,7 @@ class MSUserAbsenceSyncTest extends TestCase
self::assertEquals($expectedAbsenceStart, $user->getAbsenceStart(), $message);
}
public function provideDataTestSyncUserAbsence(): iterable
public static function provideDataTestSyncUserAbsence(): iterable
{
yield [new User(), false, false, null, 'user present remains present'];
yield [new User(), true, true, new \DateTimeImmutable('2023-07-01T12:00:00'), 'user present becomes absent'];

View File

@@ -36,7 +36,7 @@ final class CalendarACLAwareRepositoryTest extends KernelTestCase
{
self::bootKernel();
$this->entityManager = self::$container->get(EntityManagerInterface::class);
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
}
public function testCountByPerosn()

View File

@@ -32,7 +32,7 @@ final class CalendarNormalizerTest extends KernelTestCase
{
self::bootKernel();
$this->normalizer = self::$container->get(NormalizerInterface::class);
$this->normalizer = self::getContainer()->get(NormalizerInterface::class);
}
public function testNormalizationCalendar()

View File

@@ -47,7 +47,7 @@ final class CalendarContextTest extends TestCase
{
$expected =
[
'track_datetime' => true,
'trackDatetime' => true,
'askMainPerson' => true,
'mainPersonLabel' => 'docgen.calendar.Destinee',
'askThirdParty' => false,
@@ -61,7 +61,7 @@ final class CalendarContextTest extends TestCase
{
$expected =
[
'track_datetime' => true,
'trackDatetime' => true,
'askMainPerson' => true,
'mainPersonLabel' => 'docgen.calendar.Destinee',
'askThirdParty' => false,

View File

@@ -59,7 +59,7 @@ final class BulkCalendarShortMessageSenderTest extends KernelTestCase
protected function tearDown(): void
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
foreach ($this->toDelete as [$entity, $id]) {
$entity = $em->find($entity, $id);
@@ -71,7 +71,7 @@ final class BulkCalendarShortMessageSenderTest extends KernelTestCase
public function testSendBulkMessageToEligibleCalendar()
{
$em = self::$container->get(EntityManagerInterface::class);
$em = self::getContainer()->get(EntityManagerInterface::class);
$calendar = new Calendar();
$calendar
->addPerson($this->getRandomPerson($em))

View File

@@ -35,7 +35,7 @@ final class DefaultRangeGeneratorTest extends TestCase
* * Jeudi => envoi des rdv du samedi et dimanche
* * Vendredi => Envoi des rdv du lundi.
*/
public function generateData(): \Iterator
public static function generateData(): \Iterator
{
yield [
new \DateTimeImmutable('2022-06-13 10:45:00'),