| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Billing;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\AccessWish\AccessWish;
- use App\Entity\Organization\Organization;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- #[ApiResource(operations: [])]
- #[ORM\Entity]
- class BillSchedule
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- private int $id;
- #[ORM\ManyToOne(targetEntity: Organization::class, cascade: [], inversedBy: 'billSchedules')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
- protected Organization $organization;
- #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: BillScheduleDate::class, cascade: ['persist'], orphanRemoval: true)]
- protected Collection $scheduleDates;
- #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: AccessBilling::class, cascade: [], orphanRemoval: false)] // TODO: à revoir
- protected Collection $accessBilling;
- #[ORM\OneToMany(mappedBy: 'billSchedule', targetEntity: AccessWish::class, cascade: [], orphanRemoval: false)] // TODO: à revoir
- protected Collection $accessWishes;
- public function getId(): int
- {
- return $this->id;
- }
- public function setId(int $id): self
- {
- $this->id = $id;
- return $this;
- }
- public function getOrganization(): Organization
- {
- return $this->organization;
- }
- public function setOrganization(Organization $organization): self
- {
- $this->organization = $organization;
- return $this;
- }
- public function getScheduleDates(): Collection
- {
- return $this->scheduleDates;
- }
- public function addScheduleDate(BillScheduleDate $scheduleDate): self
- {
- if (!$this->scheduleDates->contains($scheduleDate)) {
- $this->scheduleDates[] = $scheduleDate;
- $scheduleDate->setBillSchedule($this);
- }
- return $this;
- }
- public function removeScheduleDate(BillScheduleDate $scheduleDate): self
- {
- if ($this->scheduleDates->removeElement($scheduleDate)) {
- $scheduleDate->setBillSchedule(null);
- }
- return $this;
- }
- public function getAccessBilling(): Collection
- {
- return $this->accessBilling;
- }
- public function addAccessBilling(AccessBilling $accessBilling): self
- {
- if (!$this->accessBilling->contains($accessBilling)) {
- $this->accessBilling[] = $accessBilling;
- $accessBilling->setBillSchedule($this);
- }
- return $this;
- }
- public function removeAccessBilling(AccessBilling $accessBilling): self
- {
- if ($this->accessBilling->removeElement($accessBilling)) {
- // $accessBilling->setBillSchedule(null); // TODO: actuellement, pas nullable: conserver?
- }
- return $this;
- }
- public function getAccessWishes(): Collection
- {
- return $this->accessWishes;
- }
- public function addAccessWish(AccessWish $accessWish): self
- {
- if (!$this->accessWishes->contains($accessWish)) {
- $this->accessWishes[] = $accessWish;
- $accessWish->setBillSchedule($this);
- }
- return $this;
- }
- public function removeAccessWish(AccessWish $accessWish): self
- {
- if ($this->accessWishes->removeElement($accessWish)) {
- // $accessWish->setBillSchedule(null); // TODO: actuellement, pas nullable: conserver?
- }
- return $this;
- }
- }
|