| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Billing;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\Organization\Organization;
- use App\Repository\Billing\BillingSettingRepository;
- // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use JetBrains\PhpStorm\Pure;
- /**
- * Paramètres globaux d'une Organization concernant la facturation.
- */
- #[ApiResource(operations: [])]
- // #[Auditable]
- #[ORM\Entity(repositoryClass: BillingSettingRepository::class)]
- class BillingSetting
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- private ?int $id = null;
- #[ORM\OneToOne(inversedBy: 'billingSetting')]
- #[ORM\JoinColumn(nullable: false)]
- private Organization $organization;
- /** @var Collection<int, ResidenceArea> */
- #[ORM\OneToMany(targetEntity: ResidenceArea::class, mappedBy: 'billingSetting', cascade: ['persist'], orphanRemoval: true)]
- private Collection $residenceAreas;
- #[ORM\Column(options: ['default' => false])]
- private bool $applyVat = false;
- /** @var Collection<int, FamilyQuotient> */
- #[ORM\OneToMany(targetEntity: FamilyQuotient::class, mappedBy: 'billingSetting', cascade: ['persist'], orphanRemoval: true)]
- private Collection $familyQuotients;
- #[ORM\OneToOne(targetEntity: BillingSettingRent::class, mappedBy: 'billingSetting', cascade: ['persist', 'remove'])]
- protected ?BillingSettingRent $billingSettingRent;
- #[Pure]
- public function __construct()
- {
- $this->residenceAreas = new ArrayCollection();
- $this->familyQuotients = 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 getApplyVat(): bool
- {
- return $this->applyVat;
- }
- public function setApplyVat(bool $applyVat): self
- {
- $this->applyVat = $applyVat;
- return $this;
- }
- public function getResidenceAreas(): Collection
- {
- return $this->residenceAreas;
- }
- public function addResidenceArea(ResidenceArea $residenceArea): self
- {
- if (!$this->residenceAreas->contains($residenceArea)) {
- $this->residenceAreas[] = $residenceArea;
- $residenceArea->setBillingSetting($this);
- }
- return $this;
- }
- public function removeResidenceArea(ResidenceArea $residenceArea): self
- {
- if ($this->residenceAreas->removeElement($residenceArea)) {
- // set the owning side to null (unless already changed)
- if ($residenceArea->getBillingSetting() === $this) {
- $residenceArea->setBillingSetting(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, FamilyQuotient>
- */
- public function getFamilyQuotients(): Collection
- {
- return $this->familyQuotients;
- }
- public function addFamilyQuotient(FamilyQuotient $familyQuotient): self
- {
- if (!$this->familyQuotients->contains($familyQuotient)) {
- $this->familyQuotients[] = $familyQuotient;
- $familyQuotient->setBillingSetting($this);
- }
- return $this;
- }
- public function removeFamilyQuotient(FamilyQuotient $familyQuotient): self
- {
- if ($this->familyQuotients->removeElement($familyQuotient)) {
- // set the owning side to null (unless already changed)
- if ($familyQuotient->getBillingSetting() === $this) {
- $familyQuotient->setBillingSetting(null);
- }
- }
- return $this;
- }
- public function getBillingSettingRent(): ?BillingSettingRent
- {
- return $this->billingSettingRent;
- }
- public function setBillingSettingRent(?BillingSettingRent $billingSettingRent): self
- {
- $this->billingSettingRent = $billingSettingRent;
- return $this;
- }
- }
|