| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Billing;
- use ApiPlatform\Core\Annotation\ApiResource;
- use App\Entity\Access\Access;
- use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\Collection;
- /**
- * Classe ... qui ...
- */
- #[Auditable]
- #[ORM\Entity]
- #[ApiResource(
- collectionOperations:[],
- itemOperations: [
- "get" => ["security" => "is_granted('ROLE_ADMIN') and object.getAccess().getOrganization().getId() == user.getOrganization().getId()"]
- ]
- )]
- class AccessBilling
- {
- #[ORM\Column]
- #[ORM\Id]
- #[ORM\GeneratedValue]
- private ?int $id = null;
- #[ORM\OneToOne(inversedBy: 'accessBilling', cascade: ['persist'], fetch: 'EAGER')]
- #[ORM\JoinColumn(nullable: true, onDelete: 'CASCADE')]
- private Access $access;
- #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accessBilling')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- private FamilyQuotient $familyQuotient;
- #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accessBilling')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- private ResidenceArea $residenceArea;
- #[ORM\OneToMany(mappedBy: 'accessBilling', targetEntity: BillPayment::class, cascade: ['persist'], orphanRemoval: true)]
- private Collection $billDetachedPayments;
- #[ORM\OneToMany(mappedBy: 'accessBilling', targetEntity: BillDebitBalance::class, cascade: ['persist'], orphanRemoval: true)]
- private Collection $billDebitBalances;
- #[ORM\OneToMany(mappedBy: 'accessBillingAccountBalanceReimbursement', targetEntity: BillPayment::class, cascade: ['persist'], orphanRemoval: true)]
- private Collection $accountBalanceReimbursements;
- public function __construct()
- {
- $this->billDetachedPayments = new ArrayCollection();
- $this->billDebitBalances = new ArrayCollection();
- $this->accountBalanceReimbursements = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getFamilyQuotient(): ?FamilyQuotient
- {
- return $this->familyQuotient;
- }
- public function setFamilyQuotient(?FamilyQuotient $familyQuotient): self
- {
- $this->familyQuotient = $familyQuotient;
- return $this;
- }
- public function getResidenceArea(): ?ResidenceArea
- {
- return $this->residenceArea;
- }
- public function setResidenceArea(?ResidenceArea $residenceArea): self
- {
- $this->residenceArea = $residenceArea;
- return $this;
- }
- /**
- * @return Collection<int, BillPayment>
- */
- public function getBillDetachedPayments(): Collection
- {
- return $this->billDetachedPayments;
- }
- public function addBillDetachedPayment(BillPayment $billDetachedPayment): self
- {
- if (!$this->billDetachedPayments->contains($billDetachedPayment)) {
- $this->billDetachedPayments[] = $billDetachedPayment;
- $billDetachedPayment->setAccessBilling($this);
- }
- return $this;
- }
- public function removeBillDetachedPayment(BillPayment $billDetachedPayment): self
- {
- if ($this->billDetachedPayments->removeElement($billDetachedPayment)) {
- // set the owning side to null (unless already changed)
- if ($billDetachedPayment->getAccessBilling() === $this) {
- $billDetachedPayment->setAccessBilling(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, BillDebitBalance>
- */
- public function getBillDebitBalances(): Collection
- {
- return $this->billDebitBalances;
- }
- public function addBillDebitBalance(BillDebitBalance $billDebitBalance): self
- {
- if (!$this->billDebitBalances->contains($billDebitBalance)) {
- $this->billDebitBalances[] = $billDebitBalance;
- $billDebitBalance->setAccessBilling($this);
- }
- return $this;
- }
- public function removeBillDebitBalance(BillDebitBalance $billDebitBalance): self
- {
- if ($this->billDebitBalances->removeElement($billDebitBalance)) {
- // set the owning side to null (unless already changed)
- if ($billDebitBalance->getAccessBilling() === $this) {
- $billDebitBalance->setAccessBilling(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, BillPayment>
- */
- public function getAccountBalanceReimbursements(): Collection
- {
- return $this->accountBalanceReimbursements;
- }
- public function addAccountBalanceReimbursement(BillPayment $accountBalanceReimbursement): self
- {
- if (!$this->accountBalanceReimbursements->contains($accountBalanceReimbursement)) {
- $this->accountBalanceReimbursements[] = $accountBalanceReimbursement;
- $accountBalanceReimbursement->setAccessBillingAccountBalanceReimbursement($this);
- }
- return $this;
- }
- public function removeAccountBalanceReimbursement(BillPayment $accountBalanceReimbursement): self
- {
- if ($this->accountBalanceReimbursements->removeElement($accountBalanceReimbursement)) {
- // set the owning side to null (unless already changed)
- if ($accountBalanceReimbursement->getAccessBillingAccountBalanceReimbursement() === $this) {
- $accountBalanceReimbursement->setAccessBillingAccountBalanceReimbursement(null);
- }
- }
- return $this;
- }
- public function getAccess(): ?Access
- {
- return $this->access;
- }
- public function setAccess(?Access $access): self
- {
- $this->access = $access;
- return $this;
- }
- }
|