From 44a5955f40c07ddb22118a3b0b507b0304e19e73 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 19 Jul 2021 15:22:36 +0200 Subject: [PATCH] rdv: allow null concerned persons in form --- .../ChillCalendarBundle/Entity/Calendar.php | 31 +++++++++++++------ .../Resources/views/Calendar/show.html.twig | 3 ++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 508279664..ca3b4b25b 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -58,7 +58,7 @@ class Calendar * @ORM\JoinTable(name="chill_calendar.calendar_to_persons") * @Groups({"read"}) */ - private Collection $persons; + private ?Collection $persons = null; /** * @@ -67,7 +67,7 @@ class Calendar * cascade={"persist", "remove", "merge", "detach"}) * @ORM\JoinTable(name="chill_calendar.calendar_to_non_professionals") */ - private Collection $nonProfessionals; + private ?Collection $nonProfessionals = null; /** * @@ -77,7 +77,7 @@ class Calendar * @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties") * @Groups({"read"}) */ - private Collection $professionals; + private ?Collection $professionals = null; /** * @@ -87,7 +87,7 @@ class Calendar * @ORM\JoinTable(name="chill_calendar.calendar_to_invites") * @Groups({"read"}) */ - private Collection $invites; + private ?Collection $invites = null; /** * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_") @@ -250,9 +250,9 @@ class Calendar return $this->persons; } - public function addPerson(Person $person): self + public function addPerson(?Person $person): self { - if (!$this->persons->contains($person)) { + if (null !== $person) { $this->persons[] = $person; } @@ -298,9 +298,9 @@ class Calendar return $this->professionals; } - public function addProfessional(ThirdParty $professional): self + public function addProfessional(?ThirdParty $professional): self { - if (!$this->professionals->contains($professional)) { + if (null !== $professional) { $this->professionals[] = $professional; } @@ -322,9 +322,9 @@ class Calendar return $this->invites; } - public function addInvite(Invite $invite): self + public function addInvite(?Invite $invite): self { - if (!$this->invites->contains($invite)) { + if (null !== $invite) { $this->invites[] = $invite; } @@ -401,4 +401,15 @@ class Calendar } return []; } + + + public function getThirdParties(): Collection + { + return $this->getProfessionals(); + } + + public function getusers(): Collection + { + return $this->getInvites(); //TODO get users of the invite + } } diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig index 95af5c686..3617bb3c7 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig @@ -4,6 +4,9 @@ +

{{ 'Concerned groups'|trans }}

+{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc' } %} +

{{ 'Calendar data'|trans }}