mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
Apply rector rules: symfony up to 54
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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,
|
||||
@@ -154,7 +156,7 @@ final class MapAndSubscribeUserCalendarCommand extends Command
|
||||
|
||||
$output->writeln('users synchronized');
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
@@ -162,7 +164,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',
|
||||
|
@@ -34,6 +34,6 @@ class SendShortMessageOnEligibleCalendar extends Command
|
||||
{
|
||||
$this->messageSender->sendBulkMessageToEligibleCalendars();
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -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,
|
||||
@@ -50,10 +52,7 @@ class SendTestShortMessageOnCalendarCommand extends Command
|
||||
parent::__construct('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
|
||||
{
|
||||
@@ -174,6 +173,6 @@ class SendTestShortMessageOnCalendarCommand extends Command
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -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');
|
||||
|
@@ -25,12 +25,7 @@ class CalendarAPIController extends ApiController
|
||||
{
|
||||
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');
|
||||
|
@@ -64,9 +64,8 @@ class CalendarController extends AbstractController
|
||||
|
||||
/**
|
||||
* 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->managerRegistry->getManager();
|
||||
@@ -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);
|
||||
@@ -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()) {
|
||||
@@ -385,9 +378,8 @@ 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');
|
||||
@@ -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);
|
||||
|
@@ -37,9 +37,7 @@ final readonly class CalendarDocController
|
||||
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);
|
||||
@@ -96,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)) {
|
||||
@@ -156,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)) {
|
||||
|
@@ -25,12 +25,7 @@ class CalendarRangeAPIController extends ApiController
|
||||
{
|
||||
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);
|
||||
|
@@ -38,9 +38,8 @@ class InviteApiController
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
@@ -32,9 +32,7 @@ class RemoteCalendarConnectAzureController
|
||||
{
|
||||
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', '/'));
|
||||
@@ -44,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 */
|
||||
|
@@ -29,10 +29,7 @@ class RemoteCalendarMSGraphSyncController
|
||||
{
|
||||
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')) {
|
||||
|
@@ -36,9 +36,7 @@ class RemoteCalendarProxyController
|
||||
{
|
||||
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')) {
|
||||
|
@@ -43,11 +43,8 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||
* )
|
||||
*
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "chill_calendar_calendar": Calendar::class
|
||||
* })
|
||||
*/
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_calendar_calendar' => Calendar::class])]
|
||||
class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface
|
||||
{
|
||||
use RemoteCalendarTrait;
|
||||
@@ -91,9 +88,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars")
|
||||
*
|
||||
* @Serializer\Groups({"calendar:read", "read"})
|
||||
*/
|
||||
#[Serializer\Groups(['calendar:read', 'read'])]
|
||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||
|
||||
/**
|
||||
@@ -103,9 +99,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="CalendarRange", inversedBy="calendar")
|
||||
*
|
||||
* @Serializer\Groups({"calendar:read", "read"})
|
||||
*/
|
||||
#[Serializer\Groups(['calendar:read', 'read'])]
|
||||
private ?CalendarRange $calendarRange = null;
|
||||
|
||||
/**
|
||||
@@ -115,9 +110,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
|
||||
*
|
||||
* @Serializer\Groups({"calendar:read", "read", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])]
|
||||
private CommentEmbeddable $comment;
|
||||
|
||||
/**
|
||||
@@ -134,11 +128,9 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
|
||||
/**
|
||||
* @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')]
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
/**
|
||||
@@ -147,9 +139,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
@@ -162,30 +153,25 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
*
|
||||
* @ORM\JoinTable(name="chill_calendar.calendar_to_invites")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @var Collection&Selectable<int, Invite>
|
||||
*/
|
||||
#[Serializer\Groups(['read', 'docgen:read'])]
|
||||
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')]
|
||||
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')]
|
||||
private ?User $mainUser = null;
|
||||
|
||||
/**
|
||||
@@ -200,21 +186,18 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
*
|
||||
* @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>
|
||||
*/
|
||||
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
|
||||
#[Assert\Count(min: 1, minMessage: 'calendar.At least {{ limit }} person is required.')]
|
||||
private Collection $persons;
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_")
|
||||
*
|
||||
* @Serializer\Groups({"calendar:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['calendar:read'])]
|
||||
private PrivateCommentEmbeddable $privateComment;
|
||||
|
||||
/**
|
||||
@@ -224,17 +207,15 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
*
|
||||
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
|
||||
*
|
||||
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
|
||||
*
|
||||
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
|
||||
*/
|
||||
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
|
||||
private Collection $professionals;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
private ?bool $sendSMS = false;
|
||||
|
||||
/**
|
||||
@@ -245,28 +226,24 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
/**
|
||||
* @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')]
|
||||
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'])]
|
||||
private string $status = self::STATUS_VALID;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
*/
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
private ?bool $urgent = false;
|
||||
|
||||
public function __construct()
|
||||
@@ -394,9 +371,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()) {
|
||||
@@ -541,9 +516,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());
|
||||
|
@@ -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 = '';
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -44,11 +44,9 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=false)
|
||||
*
|
||||
* @Groups({"read", "write", "calendar:read"})
|
||||
*
|
||||
* @Assert\NotNull
|
||||
*/
|
||||
#[Groups(['read', 'write', 'calendar:read'])]
|
||||
#[Assert\NotNull]
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
/**
|
||||
@@ -57,38 +55,31 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
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]
|
||||
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]
|
||||
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]
|
||||
private ?User $user = null;
|
||||
|
||||
public function getCalendar(): ?Calendar
|
||||
|
@@ -69,25 +69,22 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Serializer\Groups(groups={"calendar:read", "read"})
|
||||
*/
|
||||
#[Serializer\Groups(groups: ['calendar:read', 'read'])]
|
||||
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'])]
|
||||
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'])]
|
||||
private ?User $user = null;
|
||||
|
||||
public function getCalendar(): ?Calendar
|
||||
|
@@ -23,26 +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
|
||||
) {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user