| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Booking;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\Access\Access;
- use App\Entity\Billing\BillLine;
- use App\Entity\Billing\EducationalProjectIntangible;
- use App\Entity\Billing\EducationalProjectPayer;
- use App\Entity\Core\File;
- use App\Entity\Core\Tagg;
- use App\Entity\Organization\Organization;
- use App\Entity\Place\AbstractPlace;
- use App\Entity\Place\Room;
- // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- 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 EducationalProject, et supprimer l'attribut discr.
- * @todo : migration table tag_booking
- * Classe ... qui ...
- */
- #[ApiResource(operations: [])]
- // #[Auditable]
- #[ORM\Table(name: 'Booking')]
- #[ORM\Entity]
- class EducationalProject extends AbstractBooking
- {
- #[ORM\Column(length: 255, nullable: false)]
- protected string $discr = 'educationalproject';
- #[ORM\OneToMany(mappedBy: 'event', targetEntity: EducationalProjectRecur::class, cascade: ['persist'], orphanRemoval: true)]
- protected Collection $eventRecur;
- #[ORM\OneToMany(mappedBy: 'parent', targetEntity: EducationalProject::class, orphanRemoval: true)]
- protected Collection $timeline;
- #[ORM\ManyToOne(inversedBy: 'timeline')]
- protected EducationalProject $parent;
- #[ORM\ManyToOne(inversedBy: 'educationalProjects')]
- #[ORM\JoinColumn(nullable: false)]
- protected Organization $organization;
- #[ORM\ManyToOne(inversedBy: 'silentPartners')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- protected Access $silentPartner;
- #[ORM\ManyToOne(inversedBy: 'educationalProjects')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- protected EducationalProjectPublic $public;
- #[ORM\ManyToOne(inversedBy: 'operationalPartners')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- protected Access $operationalPartner;
- #[ORM\ManyToMany(targetEntity: Access::class)]
- #[ORM\JoinTable(name: 'educationalproject_financier')]
- protected Collection $financiers;
- #[ORM\ManyToMany(targetEntity: File::class)]
- protected Collection $files;
- #[ORM\OneToMany(mappedBy: 'educationalProject', targetEntity: EducationalProjectIntangible::class, cascade: ['persist'], orphanRemoval: true)]
- protected Collection $educationalProjectIntangibles;
- #[ORM\OneToMany(mappedBy: 'educationalProjectReceiver', targetEntity: EducationalProjectPayer::class, cascade: ['persist'], orphanRemoval: true)]
- protected Collection $billingReceivers;
- #[ORM\OneToMany(mappedBy: 'educationalProject', targetEntity: BillLine::class, orphanRemoval: true)]
- protected Collection $billLines;
- #[ORM\OneToMany(mappedBy: 'educationalProject', targetEntity: AttendanceBooking::class, cascade: ['persist'], orphanRemoval: true)]
- #[ORM\JoinColumn(nullable: false)]
- protected Collection $attendanceBooking;
- #[ORM\ManyToOne(inversedBy: 'educationalProjects')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- protected AbstractPlace $place;
- #[ORM\ManyToOne(inversedBy: 'educationalProjects')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- protected Room $room;
- #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'educationalProjectOrganizers')]
- #[ORM\JoinTable(name: 'booking_organizer')]
- #[ORM\JoinColumn(name: 'booking_id', referencedColumnName: 'id')]
- #[ORM\InverseJoinColumn(name: 'organizer_id', referencedColumnName: 'id')]
- protected Collection $organizer;
- #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'educationalProjects', cascade: ['persist'])]
- #[ORM\JoinTable(name: 'tag_booking')]
- #[ORM\JoinColumn(name: 'booking_id', referencedColumnName: 'id')]
- #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- protected Collection $tags;
- #[ORM\ManyToMany(targetEntity: Equipment::class, cascade: [], orphanRemoval: false)]
- protected Collection $equipments;
- #[ORM\OneToOne(targetEntity: EducationalProjectAge::class, cascade: ['persist'])]
- protected EducationalProjectAge $ageDistribution;
- public function __construct()
- {
- $this->eventRecur = new ArrayCollection();
- $this->timeline = new ArrayCollection();
- $this->financiers = new ArrayCollection();
- $this->files = new ArrayCollection();
- $this->educationalProjectIntangibles = new ArrayCollection();
- $this->billingReceivers = new ArrayCollection();
- $this->billLines = new ArrayCollection();
- $this->attendanceBooking = new ArrayCollection();
- $this->organizer = new ArrayCollection();
- $this->tags = new ArrayCollection();
- }
- public function getDiscr(): ?string
- {
- return $this->discr;
- }
- public function setDiscr(string $discr): self
- {
- $this->discr = $discr;
- return $this;
- }
- /**
- * @return Collection<int, EducationalProjectRecur>
- */
- public function getEventRecur(): Collection
- {
- return $this->eventRecur;
- }
- public function addEventRecur(EducationalProjectRecur $eventRecur): self
- {
- if (!$this->eventRecur->contains($eventRecur)) {
- $this->eventRecur[] = $eventRecur;
- $eventRecur->setEvent($this);
- }
- return $this;
- }
- public function removeEventRecur(EducationalProjectRecur $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;
- }
- /**
- * @return Collection<int, EducationalProject>
- */
- public function getTimeline(): Collection
- {
- return $this->timeline;
- }
- public function addTimeline(EducationalProject $timeline): self
- {
- if (!$this->timeline->contains($timeline)) {
- $this->timeline[] = $timeline;
- $timeline->setParent($this);
- }
- return $this;
- }
- public function removeTimeline(EducationalProject $timeline): self
- {
- if ($this->timeline->removeElement($timeline)) {
- // set the owning side to null (unless already changed)
- if ($timeline->getParent() === $this) {
- $timeline->setParent(null);
- }
- }
- return $this;
- }
- public function getParent(): ?self
- {
- return $this->parent;
- }
- public function setParent(?self $parent): self
- {
- $this->parent = $parent;
- return $this;
- }
- public function getOrganization(): ?Organization
- {
- return $this->organization;
- }
- public function setOrganization(?Organization $organization): self
- {
- $this->organization = $organization;
- return $this;
- }
- public function getSilentPartner(): ?Access
- {
- return $this->silentPartner;
- }
- public function setSilentPartner(?Access $silentPartner): self
- {
- $this->silentPartner = $silentPartner;
- return $this;
- }
- public function getPublic(): ?EducationalProjectPublic
- {
- return $this->public;
- }
- public function setPublic(?EducationalProjectPublic $public): self
- {
- $this->public = $public;
- return $this;
- }
- public function getOperationalPartner(): ?Access
- {
- return $this->operationalPartner;
- }
- public function setOperationalPartner(?Access $operationalPartner): self
- {
- $this->operationalPartner = $operationalPartner;
- return $this;
- }
- /**
- * @return Collection<int, Access>
- */
- public function getFinanciers(): Collection
- {
- return $this->financiers;
- }
- public function addFinancier(Access $financier): self
- {
- if (!$this->financiers->contains($financier)) {
- $this->financiers[] = $financier;
- }
- return $this;
- }
- public function removeFinancier(Access $financier): self
- {
- $this->financiers->removeElement($financier);
- return $this;
- }
- /**
- * @return Collection<int, File>
- */
- public function getFiles(): Collection
- {
- return $this->files;
- }
- public function addFile(File $file): self
- {
- if (!$this->files->contains($file)) {
- $this->files[] = $file;
- }
- return $this;
- }
- public function removeFile(File $file): self
- {
- $this->files->removeElement($file);
- return $this;
- }
- /**
- * @return Collection<int, EducationalProjectIntangible>
- */
- public function getEducationalProjectIntangibles(): Collection
- {
- return $this->educationalProjectIntangibles;
- }
- public function addEducationalProjectIntangible(EducationalProjectIntangible $educationalProjectIntangible): self
- {
- if (!$this->educationalProjectIntangibles->contains($educationalProjectIntangible)) {
- $this->educationalProjectIntangibles[] = $educationalProjectIntangible;
- $educationalProjectIntangible->setEducationalProject($this);
- }
- return $this;
- }
- public function removeEducationalProjectIntangible(EducationalProjectIntangible $educationalProjectIntangible): self
- {
- if ($this->educationalProjectIntangibles->removeElement($educationalProjectIntangible)) {
- // set the owning side to null (unless already changed)
- if ($educationalProjectIntangible->getEducationalProject() === $this) {
- $educationalProjectIntangible->setEducationalProject(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, EducationalProjectPayer>
- */
- public function getBillingReceivers(): Collection
- {
- return $this->billingReceivers;
- }
- public function addBillingReceiver(EducationalProjectPayer $billingReceiver): self
- {
- if (!$this->billingReceivers->contains($billingReceiver)) {
- $this->billingReceivers[] = $billingReceiver;
- $billingReceiver->setEducationalProjectReceiver($this);
- }
- return $this;
- }
- public function removeBillingReceiver(EducationalProjectPayer $billingReceiver): self
- {
- if ($this->billingReceivers->removeElement($billingReceiver)) {
- // set the owning side to null (unless already changed)
- if ($billingReceiver->getEducationalProjectReceiver() === $this) {
- $billingReceiver->setEducationalProjectReceiver(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, BillLine>
- */
- public function getBillLines(): Collection
- {
- return $this->billLines;
- }
- public function addBillLine(BillLine $billLine): self
- {
- if (!$this->billLines->contains($billLine)) {
- $this->billLines[] = $billLine;
- $billLine->setEducationalProject($this);
- }
- return $this;
- }
- public function removeBillLine(BillLine $billLine): self
- {
- if ($this->billLines->removeElement($billLine)) {
- // set the owning side to null (unless already changed)
- if ($billLine->getEducationalProject() === $this) {
- $billLine->setEducationalProject(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, AttendanceBooking>
- */
- public function getAttendanceBooking(): Collection
- {
- return $this->attendanceBooking;
- }
- public function addAttendanceBooking(AttendanceBooking $attendanceBooking): self
- {
- if (!$this->attendanceBooking->contains($attendanceBooking)) {
- $this->attendanceBooking[] = $attendanceBooking;
- $attendanceBooking->setEducationalProject($this);
- }
- return $this;
- }
- public function removeAttendanceBooking(AttendanceBooking $attendanceBooking): self
- {
- if ($this->attendanceBooking->removeElement($attendanceBooking)) {
- // set the owning side to null (unless already changed)
- if ($attendanceBooking->getEducationalProject() === $this) {
- $attendanceBooking->setEducationalProject(null);
- }
- }
- return $this;
- }
- public function getPlace(): ?AbstractPlace
- {
- return $this->place;
- }
- public function setPlace(?AbstractPlace $place): self
- {
- $this->place = $place;
- return $this;
- }
- public function getRoom(): ?Room
- {
- return $this->room;
- }
- public function setRoom(?Room $room): self
- {
- $this->room = $room;
- return $this;
- }
- /**
- * @return Collection<int, Access>
- */
- public function getOrganizer(): Collection
- {
- return $this->organizer;
- }
- public function addOrganizer(Access $organizer): self
- {
- if (!$this->organizer->contains($organizer)) {
- $this->organizer[] = $organizer;
- }
- return $this;
- }
- public function removeOrganizer(Access $organizer): self
- {
- $this->organizer->removeElement($organizer);
- return $this;
- }
- /**
- * @return Collection<int, Tagg>
- */
- public function getTags(): Collection
- {
- return $this->tags;
- }
- public function addTag(Tagg $tag): self
- {
- if (!$this->tags->contains($tag)) {
- $this->tags[] = $tag;
- }
- return $this;
- }
- public function removeTag(Tagg $tag): self
- {
- $this->tags->removeElement($tag);
- return $this;
- }
- function getEquipments(): Collection
- {
- return $this->equipments;
- }
- function setEquipments(Collection $equipments): self
- {
- $this->equipments = $equipments;
- return $this;
- }
- function getAgeDistribution(): EducationalProjectAge
- {
- return $this->ageDistribution;
- }
- function setAgeDistribution(EducationalProjectAge $ageDistribution): self
- {
- $this->ageDistribution = $ageDistribution;
- return $this;
- }
- }
|