| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Billing;
- use ApiPlatform\Core\Annotation\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;
- #[Auditable]
- #[ApiResource(
- collectionOperations: [],
- itemOperations: ['get']
- )]
- #[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;
- #[ORM\OneToMany( mappedBy: 'billingSetting', targetEntity: ResidenceArea::class, cascade: ['persist'], orphanRemoval: true)]
- private Collection $residenceAreas;
- #[ORM\Column(options: ['default' => false])]
- private bool $applyVat = false;
- #[ORM\OneToMany(mappedBy: 'billingSetting', targetEntity: FamilyQuotient::class, cascade: ['persist'], orphanRemoval: true)]
- private Collection $familyQuotients;
- #[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;
- }
- }
|