rdv: allow null concerned persons in form

This commit is contained in:
nobohan 2021-07-19 15:22:36 +02:00
parent db06a64a2b
commit 44a5955f40
2 changed files with 24 additions and 10 deletions

View File

@ -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
}
}

View File

@ -4,6 +4,9 @@
</dl>
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc' } %}
<h2 class="chill-red">{{ 'Calendar data'|trans }}</h2>