Feature: [calendar] allow to create and generate calendar by person

This commit is contained in:
2022-10-21 13:24:02 +02:00
parent 43dcb46d38
commit bc1a7c1d7b
15 changed files with 677 additions and 245 deletions

View File

@@ -92,7 +92,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars")
*/
private AccompanyingPeriod $accompanyingPeriod;
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\Activity")
@@ -173,7 +173,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
* @ORM\ManyToOne(targetEntity=Person::class)
* @ORM\JoinColumn(nullable=true)
*/
private ?Person $person;
private ?Person $person = null;
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person", inversedBy="calendars")
@@ -317,6 +317,22 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
return $this->comment;
}
/**
* @return 'person'|'accompanying_period'|null
*/
public function getContext(): ?string
{
if ($this->getAccompanyingPeriod() !== null) {
return 'accompanying_period';
}
if ($this->getPerson() !== null) {
return 'person';
}
return null;
}
/**
* Each time the date and time is update, this version is incremented.
*/