src/Entity/Charge.php line 17

  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\AllocationMethod;
  4. use App\Repository\ChargeRepository;
  5. use App\Traits\TimeStampTrait;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use App\Enum\ChargeScope;
  11. use App\Enum\ChargeType;
  12. #[ORM\Entity(repositoryClassChargeRepository::class)]
  13. #[ORM\HasLifecycleCallbacks]
  14. class Charge
  15. {
  16.     use TimeStampTrait;
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     private ?int $id null;
  21.     #[ORM\Column(type'string'length255enumTypeChargeType::class)]
  22.     private ?ChargeType $chargeType null;
  23.     #[ORM\Column(type'string'length255enumTypeChargeScope::class)]
  24.     private ?ChargeScope $chargeScope null;
  25.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  26.     private ?string $amount null;
  27.     #[ORM\ManyToOne(inversedBy'charges')]
  28.     private ?Habitat $habitat null;
  29.     #[ORM\ManyToOne(inversedBy'charges')]
  30.     private ?Residence $residence null;
  31.     #[ORM\OneToMany(mappedBy'charge'targetEntityChargeAllocation::class)]
  32.     private Collection $chargeAllocations;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $description null;
  35.     #[ORM\Column(type'string'nullabletrueenumTypeAllocationMethod::class)]
  36.     private ?AllocationMethod $allocationMethod null;
  37.     #[ORM\Column(length25nullabletrue)]
  38.     private ?string $month null;
  39.     #[ORM\Column(length25nullabletrue)]
  40.     private ?string $year null;
  41.     #[ORM\ManyToOne(inversedBy'charges')]
  42.     private ?Location $Location null;
  43.     #[ORM\ManyToOne(cascade: ['all'], fetch'EAGER'inversedBy'charges',)]
  44.     private ?Entreprise $marchand null;
  45.     #[ORM\Column(length255nullabletrue)]
  46.     private ?string $code null;
  47.     #[ORM\Column]
  48.     private ?bool $paid null;
  49.     #[ORM\Column(nullabletrue)]
  50.     private ?\DateTime $paidAt null;
  51.     #[ORM\ManyToOne(cascade: ['all'], fetch'EAGER'inversedBy'charges',)]
  52.     private ?Payment $payment null;
  53.     #[ORM\Column]
  54.     private ?bool $isTvaApply null;
  55.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  56.     private ?string $totalHt null;
  57.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  58.     private ?string $tva null;
  59.     public function __construct()
  60.     {
  61.         $this->chargeAllocations = new ArrayCollection();
  62.     }
  63.     public function getId(): ?int
  64.     {
  65.         return $this->id;
  66.     }
  67.     public function getChargeType(): ?ChargeType
  68.     {
  69.         return $this->chargeType;
  70.     }
  71.     public function setChargeType(?ChargeType $chargeType): self
  72.     {
  73.         $this->chargeType $chargeType;
  74.         return $this;
  75.     }
  76.     public function getChargeScope(): ?ChargeScope
  77.     {
  78.         return $this->chargeScope;
  79.     }
  80.     public function setChargeScope(?ChargeScope $scope): self
  81.     {
  82.         $this->chargeScope $scope;
  83.         return $this;
  84.     }
  85.     public function getAmount(): ?string
  86.     {
  87.         return $this->amount;
  88.     }
  89.     public function setAmount(?string $amount): static
  90.     {
  91.         $this->amount $amount;
  92.         return $this;
  93.     }
  94.     public function getHabitat(): ?Habitat
  95.     {
  96.         return $this->habitat;
  97.     }
  98.     public function setHabitat(?Habitat $habitat): static
  99.     {
  100.         $this->habitat $habitat;
  101.         return $this;
  102.     }
  103.     public function getResidence(): ?Residence
  104.     {
  105.         return $this->residence;
  106.     }
  107.     public function setResidence(?Residence $residence): static
  108.     {
  109.         $this->residence $residence;
  110.         return $this;
  111.     }
  112.     /**
  113.      * @return Collection<int, ChargeAllocation>
  114.      */
  115.     public function getChargeAllocations(): Collection
  116.     {
  117.         return $this->chargeAllocations;
  118.     }
  119.     public function addChargeAllocation(ChargeAllocation $chargeAllocation): static
  120.     {
  121.         if (!$this->chargeAllocations->contains($chargeAllocation)) {
  122.             $this->chargeAllocations->add($chargeAllocation);
  123.             $chargeAllocation->setCharge($this);
  124.         }
  125.         return $this;
  126.     }
  127.     public function removeChargeAllocation(ChargeAllocation $chargeAllocation): static
  128.     {
  129.         if ($this->chargeAllocations->removeElement($chargeAllocation)) {
  130.             // set the owning side to null (unless already changed)
  131.             if ($chargeAllocation->getCharge() === $this) {
  132.                 $chargeAllocation->setCharge(null);
  133.             }
  134.         }
  135.         return $this;
  136.     }
  137.     public function getDescription(): ?string
  138.     {
  139.         return $this->description;
  140.     }
  141.     public function setDescription(?string $description): static
  142.     {
  143.         $this->description $description;
  144.         return $this;
  145.     }
  146.     public function getAllocationMethod(): ?AllocationMethod
  147.     {
  148.         return $this->allocationMethod;
  149.     }
  150.     public function setAllocationMethod(?AllocationMethod $method): self
  151.     {
  152.         $this->allocationMethod $method;
  153.         return $this;
  154.     }
  155.     public function getMonth(): ?string
  156.     {
  157.         return $this->month;
  158.     }
  159.     public function setMonth(?string $month): static
  160.     {
  161.         $this->month $month;
  162.         return $this;
  163.     }
  164.     public function getYear(): ?string
  165.     {
  166.         return $this->year;
  167.     }
  168.     public function setYear(?string $year): static
  169.     {
  170.         $this->year $year;
  171.         return $this;
  172.     }
  173.     public function getLocation(): ?Location
  174.     {
  175.         return $this->Location;
  176.     }
  177.     public function setLocation(?Location $Location): static
  178.     {
  179.         $this->Location $Location;
  180.         return $this;
  181.     }
  182.     public function getMarchand(): ?Entreprise
  183.     {
  184.         return $this->marchand;
  185.     }
  186.     public function setMarchand(?Entreprise $marchand): static
  187.     {
  188.         $this->marchand $marchand;
  189.         return $this;
  190.     }
  191.     public function getCode(): ?string
  192.     {
  193.         return $this->code;
  194.     }
  195.     public function setCode(?string $code): static
  196.     {
  197.         $this->code $code;
  198.         return $this;
  199.     }
  200.     public function isPaid(): ?bool
  201.     {
  202.         return $this->paid;
  203.     }
  204.     public function setPaid(bool $paid): static
  205.     {
  206.         $this->paid $paid;
  207.         return $this;
  208.     }
  209.     public function getPaidAt(): ?\DateTime
  210.     {
  211.         return $this->paidAt;
  212.     }
  213.     public function setPaidAt(?\DateTime $paidAt): static
  214.     {
  215.         $this->paidAt $paidAt;
  216.         return $this;
  217.     }
  218.     public function getPayment(): ?Payment
  219.     {
  220.         return $this->payment;
  221.     }
  222.     public function setPayment(?Payment $payment): static
  223.     {
  224.         $this->payment $payment;
  225.         return $this;
  226.     }
  227.     public function isIsTvaApply(): ?bool
  228.     {
  229.         return $this->isTvaApply;
  230.     }
  231.     public function setIsTvaApply(bool $isTvaApply): static
  232.     {
  233.         $this->isTvaApply $isTvaApply;
  234.         return $this;
  235.     }
  236.     public function getTotalHt(): ?string
  237.     {
  238.         return $this->totalHt;
  239.     }
  240.     public function setTotalHt(?string $totalHt): static
  241.     {
  242.         $this->totalHt $totalHt;
  243.         return $this;
  244.     }
  245.     public function getTva(): ?string
  246.     {
  247.         return $this->tva;
  248.     }
  249.     public function setTva(?string $tva): static
  250.     {
  251.         $this->tva $tva;
  252.         return $this;
  253.     }
  254. }