| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Billing;
- use App\Entity\Access\Access;
- use App\Entity\Core\File;
- use App\Entity\Core\Tagg;
- use App\Entity\Organization\Organization;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * Facture ou avoir.
- *
- * @see Bill, BillCredit, AdvancePayment
- *
- * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table BillAccounting, et supprimer l'attribut discr.
- */
- #[ORM\Entity]
- #[ORM\Table(name: 'BillAccounting')]
- #[ORM\InheritanceType('SINGLE_TABLE')]
- #[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
- #[ORM\DiscriminatorMap(
- [
- 'billaccounting' => BillAccounting::class,
- 'bill' => Bill::class,
- 'billcredit' => BillCredit::class,
- 'advancepayment' => AdvancePayment::class,
- ]
- )]
- class AbstractBillAccounting
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- protected ?int $id = null;
- #[ORM\ManyToOne(targetEntity: Organization::class)]
- #[ORM\JoinColumn(nullable: true)]
- protected ?Organization $organization;
- #[ORM\ManyToOne(inversedBy: 'billCredits')]
- #[ORM\JoinColumn(nullable: true)]
- protected ?Bill $bill;
- /** @var Collection<int, BillingIntangibleExcludeDate> */
- #[ORM\OneToMany(targetEntity: BillingIntangibleExcludeDate::class, mappedBy: 'bill', cascade: ['persist'], orphanRemoval: true)]
- protected Collection $billingIntangibleExcludeDates;
- #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'bills')]
- #[ORM\JoinColumn(nullable: true)]
- protected ?Pes $pes;
- #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'bills')]
- #[ORM\JoinColumn(nullable: true)]
- protected ?BergerLevrault $bergerLevrault;
- #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'bills')]
- #[ORM\JoinColumn(nullable: true)]
- protected ?Ciril $ciril;
- #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'bills')]
- #[ORM\JoinColumn(nullable: true)]
- protected ?Jvs $jvs;
- /** @var Collection<int, Tagg> */
- #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'billAccountings', cascade: ['persist'])]
- #[ORM\JoinTable(name: 'tag_billAccounting')]
- #[ORM\JoinColumn(name: 'billAccounting_id', referencedColumnName: 'id')]
- #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- protected Collection $tags;
- #[ORM\ManyToOne(targetEntity: Access::class, cascade: [], inversedBy: 'bills')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
- protected Access $access;
- #[ORM\OneToOne(targetEntity: BillAccessDetail::class, cascade: ['persist'])]
- protected ?BillAccessDetail $accessDetail;
- #[ORM\OneToOne(targetEntity: BillPeriod::class, cascade: ['persist'])]
- protected ?BillPeriod $billPeriod;
- #[ORM\OneToOne(targetEntity: BillTotalDetail::class, cascade: ['persist'])]
- protected ?BillTotalDetail $totalDetail;
- #[ORM\OneToOne(targetEntity: File::class, cascade: ['persist'])]
- protected ?File $file;
- #[ORM\ManyToOne(targetEntity: Odyssee::class, cascade: ['persist'], inversedBy: 'bills')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
- protected Odyssee $odyssee; // TODO: sûr que c'est pas nullable?
- #[ORM\ManyToOne(targetEntity: Afi::class, cascade: ['persist'], inversedBy: 'bills')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
- protected Afi $afi;
- #[ORM\ManyToOne(targetEntity: CirilCivil::class, cascade: ['persist'], inversedBy: 'bills')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
- protected CirilCivil $cirilCivil;
- public function __construct()
- {
- $this->billingIntangibleExcludeDates = new ArrayCollection();
- $this->tags = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getOrganization(): ?Organization
- {
- return $this->organization;
- }
- public function setOrganization(?Organization $organization): self
- {
- $this->organization = $organization;
- return $this;
- }
- public function getBill(): ?Bill
- {
- return $this->bill;
- }
- public function setBill(?Bill $bill): self
- {
- $this->bill = $bill;
- return $this;
- }
- /**
- * @return Collection<int, BillingIntangibleExcludeDate>
- */
- public function getBillingIntangibleExcludeDates(): Collection
- {
- return $this->billingIntangibleExcludeDates;
- }
- public function addBillingIntangibleExcludeDate(BillingIntangibleExcludeDate $billingIntangibleExcludeDate): self
- {
- if (!$this->billingIntangibleExcludeDates->contains($billingIntangibleExcludeDate)) {
- $this->billingIntangibleExcludeDates[] = $billingIntangibleExcludeDate;
- $billingIntangibleExcludeDate->setBill($this);
- }
- return $this;
- }
- public function removeBillingIntangibleExcludeDate(BillingIntangibleExcludeDate $billingIntangibleExcludeDate): self
- {
- if ($this->billingIntangibleExcludeDates->removeElement($billingIntangibleExcludeDate)) {
- // set the owning side to null (unless already changed)
- if ($billingIntangibleExcludeDate->getBill() === $this) {
- $billingIntangibleExcludeDate->setBill(null);
- }
- }
- return $this;
- }
- public function getPes(): ?Pes
- {
- return $this->pes;
- }
- public function setPes(?Pes $pes): self
- {
- $this->pes = $pes;
- return $this;
- }
- public function getBergerLevrault(): ?BergerLevrault
- {
- return $this->bergerLevrault;
- }
- public function setBergerLevrault(?BergerLevrault $bergerLevrault): self
- {
- $this->bergerLevrault = $bergerLevrault;
- return $this;
- }
- public function getCiril(): ?Ciril
- {
- return $this->ciril;
- }
- public function setCiril(?Ciril $ciril): self
- {
- $this->ciril = $ciril;
- return $this;
- }
- public function getJvs(): ?Jvs
- {
- return $this->jvs;
- }
- public function setJvs(?Jvs $jvs): self
- {
- $this->jvs = $jvs;
- 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;
- $tag->addBillAccounting($this);
- }
- return $this;
- }
- public function removeTag(Tagg $tag): self
- {
- if ($this->tags->removeElement($tag)) {
- $tag->removeBillAccounting($this);
- }
- return $this;
- }
- public function getAccess(): Access
- {
- return $this->access;
- }
- public function setAccess(Access $access): self
- {
- $this->access = $access;
- return $this;
- }
- public function getAccessDetail(): BillAccessDetail
- {
- return $this->accessDetail;
- }
- public function setAccessDetail(BillAccessDetail $accessDetail): self
- {
- $this->accessDetail = $accessDetail;
- return $this;
- }
- public function getBillPeriod(): BillPeriod
- {
- return $this->billPeriod;
- }
- public function setBillPeriod(BillPeriod $billPeriod): self
- {
- $this->billPeriod = $billPeriod;
- return $this;
- }
- public function getTotalDetail(): BillTotalDetail
- {
- return $this->totalDetail;
- }
- public function setTotalDetail(BillTotalDetail $totalDetail): self
- {
- $this->totalDetail = $totalDetail;
- return $this;
- }
- public function getFile(): File
- {
- return $this->file;
- }
- public function setFile(File $file): self
- {
- $this->file = $file;
- return $this;
- }
- public function getOdyssee(): Odyssee
- {
- return $this->odyssee;
- }
- public function setOdyssee(Odyssee $odyssee): self
- {
- $this->odyssee = $odyssee;
- return $this;
- }
- public function getAfi(): Afi
- {
- return $this->afi;
- }
- public function setAfi(Afi $afi): self
- {
- $this->afi = $afi;
- return $this;
- }
- public function getCirilCivil(): CirilCivil
- {
- return $this->cirilCivil;
- }
- public function setCirilCivil(CirilCivil $cirilCivil): self
- {
- $this->cirilCivil = $cirilCivil;
- return $this;
- }
- }
|