mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Feature: [calendar] allow to create and generate calendar by person
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user