mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
368 lines
7.8 KiB
PHP
368 lines
7.8 KiB
PHP
<?php
|
|
|
|
namespace Chill\CalendarBundle\Entity;
|
|
|
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Chill\MainBundle\Entity\User;
|
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
use Chill\PersonBundle\Entity\Person;
|
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
|
use Chill\CalendarBundle\Entity\CancelReason;
|
|
use Chill\CalendarBundle\Entity\CalendarRange;
|
|
use Chill\CalendarBundle\Entity\Invite;
|
|
use Chill\ActivityBundle\Entity\Activity;
|
|
|
|
/**
|
|
* @ORM\Table(name="chill_calendar.calendar")
|
|
* @ORM\Entity(repositoryClass=CalendarRepository::class)
|
|
*/
|
|
class Calendar
|
|
{
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue
|
|
* @ORM\Column(type="integer")
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="User")
|
|
*/
|
|
private User $user;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="AccompanyingPeriod")
|
|
*/
|
|
private AccompanyingPeriod $accompanyingPeriod;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="User")
|
|
*/
|
|
private User $mainUser;
|
|
|
|
/**
|
|
*
|
|
* @ORM\ManyToMany(
|
|
* targetEntity="Person",
|
|
* cascade={"persist", "remove", "merge", "detach"})
|
|
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
|
|
*/
|
|
private Collection $persons;
|
|
|
|
/**
|
|
*
|
|
* @ORM\ManyToMany(
|
|
* targetEntity="Person",
|
|
* cascade={"persist", "remove", "merge", "detach"})
|
|
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
|
|
*/
|
|
private Collection $nonProfessionals;
|
|
|
|
/**
|
|
*
|
|
* @ORM\ManyToMany(
|
|
* targetEntity="ThirdParty",
|
|
* cascade={"persist", "remove", "merge", "detach"})
|
|
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
|
|
*/
|
|
private Collection $professionals;
|
|
|
|
/**
|
|
*
|
|
* @ORM\ManyToMany(
|
|
* targetEntity="Invite",
|
|
* cascade={"persist", "remove", "merge", "detach"})
|
|
* @ORM\JoinTable(name="chill_calendar.calendar_to_invites")
|
|
*/
|
|
private Collection $invites;
|
|
|
|
/**
|
|
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
|
|
*/
|
|
private CommentEmbeddable $comment;
|
|
|
|
/**
|
|
* @ORM\Column(type="date_immutable")
|
|
*/
|
|
private \DateTimeImmutable $startDate;
|
|
|
|
/**
|
|
* @ORM\Column(type="date_immutable")
|
|
*/
|
|
private \DateTimeImmutable $endDate;
|
|
|
|
//TODO Lieu
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=255)
|
|
*/
|
|
private string $status;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="CancelReason")
|
|
*/
|
|
private ?CancelReason $cancelReason = null;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="CalendarRange")
|
|
*/
|
|
private ?CalendarRange $calendarRange = null;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="Activity")
|
|
*/
|
|
private Activity $activity;
|
|
|
|
/**
|
|
* @ORM\Column(type="boolean", nullable=true)
|
|
*/
|
|
private $sendSMS;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->comment = new CommentEmbeddable();
|
|
$this->persons = new ArrayCollection();
|
|
$this->nonProfessionals = new ArrayCollection();
|
|
$this->professionals = new ArrayCollection();
|
|
$this->invites = new ArrayCollection();
|
|
}
|
|
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getSendSMS(): ?bool
|
|
{
|
|
return $this->sendSMS;
|
|
}
|
|
|
|
public function setSendSMS(?bool $sendSMS): self
|
|
{
|
|
$this->sendSMS = $sendSMS;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getComment(): CommentEmbeddable
|
|
{
|
|
return $this->comment;
|
|
}
|
|
|
|
public function setComment(CommentEmbeddable $comment): self
|
|
{
|
|
$this->comment = $comment;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getStartDate(): ?\DateTimeImmutable
|
|
{
|
|
return $this->startDate;
|
|
}
|
|
|
|
public function setStartDate(\DateTimeImmutable $startDate): self
|
|
{
|
|
$this->startDate = $startDate;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getEndDate(): ?\DateTimeImmutable
|
|
{
|
|
return $this->endDate;
|
|
}
|
|
|
|
public function setEndDate(\DateTimeImmutable $endDate): self
|
|
{
|
|
$this->endDate = $endDate;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getStatus(): ?string
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
public function setStatus(string $status): self
|
|
{
|
|
$this->status = $status;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getUser(): ?User
|
|
{
|
|
return $this->user;
|
|
}
|
|
|
|
public function setUser(?User $user): self
|
|
{
|
|
$this->user = $user;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAccompanyingPeriod(): ?AccompanyingPeriod
|
|
{
|
|
return $this->accompanyingPeriod;
|
|
}
|
|
|
|
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
|
|
{
|
|
$this->accompanyingPeriod = $accompanyingPeriod;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getMainUser(): ?User
|
|
{
|
|
return $this->mainUser;
|
|
}
|
|
|
|
public function setMainUser(?User $mainUser): self
|
|
{
|
|
$this->mainUser = $mainUser;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|Person[]
|
|
*/
|
|
public function getPersons(): Collection
|
|
{
|
|
return $this->persons;
|
|
}
|
|
|
|
public function addPerson(Person $person): self
|
|
{
|
|
if (!$this->persons->contains($person)) {
|
|
$this->persons[] = $person;
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removePerson(Person $person): self
|
|
{
|
|
$this->persons->removeElement($person);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|Person[]
|
|
*/
|
|
public function getNonProfessionals(): Collection
|
|
{
|
|
return $this->nonProfessionals;
|
|
}
|
|
|
|
public function addNonProfessional(Person $nonProfessional): self
|
|
{
|
|
if (!$this->nonProfessionals->contains($nonProfessional)) {
|
|
$this->nonProfessionals[] = $nonProfessional;
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeNonProfessional(Person $nonProfessional): self
|
|
{
|
|
$this->nonProfessionals->removeElement($nonProfessional);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|ThirdParty[]
|
|
*/
|
|
public function getProfessionals(): Collection
|
|
{
|
|
return $this->professionals;
|
|
}
|
|
|
|
public function addProfessional(ThirdParty $professional): self
|
|
{
|
|
if (!$this->professionals->contains($professional)) {
|
|
$this->professionals[] = $professional;
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeProfessional(ThirdParty $professional): self
|
|
{
|
|
$this->professionals->removeElement($professional);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|Invite[]
|
|
*/
|
|
public function getInvites(): Collection
|
|
{
|
|
return $this->invites;
|
|
}
|
|
|
|
public function addInvite(Invite $invite): self
|
|
{
|
|
if (!$this->invites->contains($invite)) {
|
|
$this->invites[] = $invite;
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeInvite(Invite $invite): self
|
|
{
|
|
$this->invites->removeElement($invite);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCancelReason(): ?CancelReason
|
|
{
|
|
return $this->cancelReason;
|
|
}
|
|
|
|
public function setCancelReason(?CancelReason $cancelReason): self
|
|
{
|
|
$this->cancelReason = $cancelReason;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCalendarRange(): ?CalendarRange
|
|
{
|
|
return $this->calendarRange;
|
|
}
|
|
|
|
public function setCalendarRange(?CalendarRange $calendarRange): self
|
|
{
|
|
$this->calendarRange = $calendarRange;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getActivity(): ?Activity
|
|
{
|
|
return $this->activity;
|
|
}
|
|
|
|
public function setActivity(?Activity $activity): self
|
|
{
|
|
$this->activity = $activity;
|
|
|
|
return $this;
|
|
}
|
|
}
|