| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Booking;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\Access\Access;
- // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use App\Entity\Core\Tagg;
- use App\Entity\Organization\Organization;
- use App\Entity\Product\Equipment;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table PersonHoliday, et supprimer l'attribut discr.
- *
- * Classe ... qui ...
- */
- #[ApiResource(operations: [])]
- // #[Auditable]
- #[ORM\Entity]
- #[ORM\Table(name: 'Booking')]
- class PersonHoliday extends AbstractBooking
- {
- #[ORM\Column(length: 255, nullable: false)]
- private string $discr = 'personholiday';
- #[ORM\OneToMany(mappedBy: 'event', targetEntity: PersonHolidayRecur::class, cascade: ['persist'], orphanRemoval: true)]
- protected Collection $eventRecur;
- #[ORM\ManyToOne(inversedBy: 'holidays')]
- private Access $access;
- #[ORM\ManyToOne(targetEntity: Organization::class, cascade: [])]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
- protected Organization $organization;
- public function __construct()
- {
- $this->eventRecur = new ArrayCollection();
- $this->organizer = new ArrayCollection();
- $this->equipments = new ArrayCollection();
- $this->tags = new ArrayCollection();
- parent::__construct();
- }
- public function getDiscr(): ?string
- {
- return $this->discr;
- }
- public function setDiscr(string $discr): self
- {
- $this->discr = $discr;
- return $this;
- }
- /**
- * @return Collection<int, PersonHolidayRecur>
- */
- public function getEventRecur(): Collection
- {
- return $this->eventRecur;
- }
- public function addEventRecur(PersonHolidayRecur $eventRecur): self
- {
- if (!$this->eventRecur->contains($eventRecur)) {
- $this->eventRecur[] = $eventRecur;
- $eventRecur->setEvent($this);
- }
- return $this;
- }
- public function removeEventRecur(PersonHolidayRecur $eventRecur): self
- {
- if ($this->eventRecur->removeElement($eventRecur)) {
- // set the owning side to null (unless already changed)
- if ($eventRecur->getEvent() === $this) {
- $eventRecur->setEvent(null);
- }
- }
- return $this;
- }
- public function getAccess(): ?Access
- {
- return $this->access;
- }
- public function setAccess(?Access $access): self
- {
- $this->access = $access;
- return $this;
- }
- function getOrganization(): Organization
- {
- return $this->organization;
- }
- function setOrganization(Organization $organization): self
- {
- $this->organization = $organization;
- return $this;
- }
- }
|