src/Entity/Location.php line 17

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LocationRepository;
  4. use App\Traits\TimeStampTrait;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Uid\Uuid;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. #[ORM\Entity(repositoryClassLocationRepository::class)]
  12. #[ORM\HasLifecycleCallbacks]
  13. class Location
  14. {
  15.     use TimeStampTrait;
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column]
  19.     private ?int $id null;
  20.     #[ORM\Column(length100)]
  21.     private ?string $code null;
  22.     #[ORM\ManyToOne(cascade: ['all'], fetch'EAGER'inversedBy'locations')]
  23.     private ?Locataire $locataire null;
  24.     #[ORM\ManyToOne(inversedBy'locations')]
  25.     private ?Habitat $habitat null;
  26.     #[ORM\ManyToOne(inversedBy'locations')]
  27.     private ?User $createdBy null;
  28.     #[ORM\Column]
  29.     private ?bool $status null;
  30.     #[ORM\Column(nullabletrue)]
  31.     private ?bool $occuper null;
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $commentaire null;
  34.     #[ORM\Column(length15nullabletrue)]
  35.     private ?string $garanty null;
  36.     #[ORM\OneToMany(mappedBy'location'targetEntityPaymentGaranty::class)]
  37.     private Collection $paymentGaranties;
  38.     #[ORM\Column(length15nullabletrue)]
  39.     private ?string $maxGaranty null;
  40.     #[ORM\Column(length50nullabletrue)]
  41.     private ?string $paymentDueDate null;
  42.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  43.     private ?string $price null;
  44.     #[ORM\Column(type'date'nullabletrue)]
  45.     private $endLocationAt;
  46.     #[ORM\Column(length255nullabletrue)]
  47.     private ?string $commentaire2 null;
  48.     #[ORM\Column(length100nullabletrue)]
  49.     private ?string $type null;
  50.     #[ORM\Column(type'datetime'nullabletrue)]
  51.     private $startAt;
  52.     #[ORM\Column(type'datetime'nullabletrue)]
  53.     private $endAt;
  54.     #[ORM\ManyToOne(inversedBy'locations')]
  55.     private ?Entreprise $marchand null;
  56.     #[ORM\Column(length100nullabletrue)]
  57.     private ?string $locationUsage null;
  58.     #[ORM\Column(length25nullabletrue)]
  59.     private ?string $duree null;
  60.     #[ORM\OneToMany(mappedBy'location'targetEntityContractBail::class)]
  61.     private Collection $contrat;
  62.     #[ORM\OneToMany(mappedBy'location'targetEntityPayment::class, cascade: ['all'], fetch'EAGER')]
  63.     private Collection $payments;
  64.     #[ORM\OneToMany(mappedBy'location'targetEntityIncident::class)]
  65.     private Collection $incidents;
  66.     #[ORM\Column(length25nullabletrue)]
  67.     private ?string $paymentPeriod null;
  68.     #[ORM\Column(length25nullabletrue)]
  69.     private ?string $typeGaranty null;
  70.     #[ORM\Column(length25nullabletrue)]
  71.     private ?string $reconduction null;
  72.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  73.     private ?string $garantyTobepaid null;
  74.     #[ORM\Column(length10nullabletrue)]
  75.     private ?string $mode null;
  76.     #[ORM\Column(type'uuid'uniquetruenullabletrue)]
  77.     private ?Uuid $uuid;
  78.     #[ORM\Column(nullabletrue)]
  79.     private ?bool $reserver null;
  80.     #[ORM\Column(length25nullabletrue)]
  81.     private ?string $locationType null;
  82.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  83.     private ?string $lastExpenseAmount null;
  84.     #[ORM\OneToMany(mappedBy'location'targetEntityChargeAllocation::class)]
  85.     private Collection $chargeAllocations;
  86.     #[ORM\Column(nullabletrue)]
  87.     private ?int $occupants null;
  88.     #[ORM\OneToMany(mappedBy'Location'targetEntityCharge::class)]
  89.     private Collection $charges;
  90.     #[ORM\ManyToOne(inversedBy'locations')]
  91.     private ?Residence $residence null;
  92.     #[ORM\Column]
  93.     private ?bool $isTvaApply null;
  94.     #[ORM\Column(typeTypes::DECIMALprecision10scale2nullabletrue)]
  95.     private ?string $tva null;
  96.     public function __construct()
  97.     {
  98.         $this->paymentGaranties = new ArrayCollection();
  99.         $this->contrat = new ArrayCollection();
  100.         $this->payments = new ArrayCollection();
  101.         $this->incidents = new ArrayCollection();
  102.         $this->chargeAllocations = new ArrayCollection();
  103.         $this->charges = new ArrayCollection();
  104.     }
  105.     /**
  106.      * @return int|null
  107.      */
  108.     public function getId(): ?int
  109.     {
  110.         return $this->id;
  111.     }
  112.     /**
  113.      * @param int|null $id
  114.      */
  115.     public function setId(?int $id): void
  116.     {
  117.         $this->id $id;
  118.     }
  119.     /**
  120.      * @return string|null
  121.      */
  122.     public function getCode(): ?string
  123.     {
  124.         return $this->code;
  125.     }
  126.     /**
  127.      * @param string|null $code
  128.      */
  129.     public function setCode(?string $code): void
  130.     {
  131.         $this->code $code;
  132.     }
  133.     /**
  134.      * @return Locataire|null
  135.      */
  136.     public function getLocataire(): ?Locataire
  137.     {
  138.         return $this->locataire;
  139.     }
  140.     /**
  141.      * @param Locataire|null $locataire
  142.      */
  143.     public function setLocataire(?Locataire $locataire): void
  144.     {
  145.         $this->locataire $locataire;
  146.     }
  147.     /**
  148.      * @return Habitat|null
  149.      */
  150.     public function getHabitat(): ?Habitat
  151.     {
  152.         return $this->habitat;
  153.     }
  154.     /**
  155.      * @param Habitat|null $habitat
  156.      */
  157.     public function setHabitat(?Habitat $habitat): void
  158.     {
  159.         $this->habitat $habitat;
  160.     }
  161.     /**
  162.      * @return User|null
  163.      */
  164.     public function getCreatedBy(): ?User
  165.     {
  166.         return $this->createdBy;
  167.     }
  168.     /**
  169.      * @param User|null $createdBy
  170.      */
  171.     public function setCreatedBy(?User $createdBy): void
  172.     {
  173.         $this->createdBy $createdBy;
  174.     }
  175.     /**
  176.      * @return bool|null
  177.      */
  178.     public function getStatus(): ?bool
  179.     {
  180.         return $this->status;
  181.     }
  182.     /**
  183.      * @param bool|null $status
  184.      */
  185.     public function setStatus(?bool $status): void
  186.     {
  187.         $this->status $status;
  188.     }
  189.     /**
  190.      * @return bool|null
  191.      */
  192.     public function getOccuper(): ?bool
  193.     {
  194.         return $this->occuper;
  195.     }
  196.     /**
  197.      * @param bool|null $occuper
  198.      */
  199.     public function setOccuper(?bool $occuper): void
  200.     {
  201.         $this->occuper $occuper;
  202.     }
  203.     /**
  204.      * @return string|null
  205.      */
  206.     public function getCommentaire(): ?string
  207.     {
  208.         return $this->commentaire;
  209.     }
  210.     /**
  211.      * @param string|null $commentaire
  212.      */
  213.     public function setCommentaire(?string $commentaire): void
  214.     {
  215.         $this->commentaire $commentaire;
  216.     }
  217.     /**
  218.      * @return string|null
  219.      */
  220.     public function getGaranty(): ?string
  221.     {
  222.         return $this->garanty;
  223.     }
  224.     /**
  225.      * @param string|null $garanty
  226.      */
  227.     public function setGaranty(?string $garanty): void
  228.     {
  229.         $this->garanty $garanty;
  230.     }
  231.     /**
  232.      * @return ArrayCollection|Collection
  233.      */
  234.     public function getPaymentGaranties(): ArrayCollection|Collection
  235.     {
  236.         return $this->paymentGaranties;
  237.     }
  238.     /**
  239.      * @param ArrayCollection|Collection $paymentGaranties
  240.      */
  241.     public function setPaymentGaranties(ArrayCollection|Collection $paymentGaranties): void
  242.     {
  243.         $this->paymentGaranties $paymentGaranties;
  244.     }
  245.     /**
  246.      * @return string|null
  247.      */
  248.     public function getMaxGaranty(): ?string
  249.     {
  250.         return $this->maxGaranty;
  251.     }
  252.     /**
  253.      * @param string|null $maxGaranty
  254.      */
  255.     public function setMaxGaranty(?string $maxGaranty): void
  256.     {
  257.         $this->maxGaranty $maxGaranty;
  258.     }
  259.     /**
  260.      * @return string|null
  261.      */
  262.     public function getPaymentDueDate(): ?string
  263.     {
  264.         return $this->paymentDueDate;
  265.     }
  266.     /**
  267.      * @param string|null $paymentDueDate
  268.      */
  269.     public function setPaymentDueDate(?string $paymentDueDate): void
  270.     {
  271.         $this->paymentDueDate $paymentDueDate;
  272.     }
  273.     /**
  274.      * @return string|null
  275.      */
  276.     public function getPrice(): ?string
  277.     {
  278.         return $this->price;
  279.     }
  280.     /**
  281.      * @param string|null $price
  282.      */
  283.     public function setPrice(?string $price): void
  284.     {
  285.         $this->price $price;
  286.     }
  287.     /**
  288.      * @return mixed
  289.      */
  290.     public function getEndLocationAt()
  291.     {
  292.         return $this->endLocationAt;
  293.     }
  294.     /**
  295.      * @param mixed $endLocationAt
  296.      */
  297.     public function setEndLocationAt($endLocationAt): void
  298.     {
  299.         $this->endLocationAt $endLocationAt;
  300.     }
  301.     /**
  302.      * @return string|null
  303.      */
  304.     public function getCommentaire2(): ?string
  305.     {
  306.         return $this->commentaire2;
  307.     }
  308.     /**
  309.      * @param string|null $commentaire2
  310.      */
  311.     public function setCommentaire2(?string $commentaire2): void
  312.     {
  313.         $this->commentaire2 $commentaire2;
  314.     }
  315.     /**
  316.      * @return string|null
  317.      */
  318.     public function getType(): ?string
  319.     {
  320.         return $this->type;
  321.     }
  322.     /**
  323.      * @param string|null $type
  324.      */
  325.     public function setType(?string $type): void
  326.     {
  327.         $this->type $type;
  328.     }
  329.     /**
  330.      * @return mixed
  331.      */
  332.     public function getStartAt()
  333.     {
  334.         return $this->startAt;
  335.     }
  336.     /**
  337.      * @param mixed $startAt
  338.      */
  339.     public function setStartAt($startAt): void
  340.     {
  341.         $this->startAt $startAt;
  342.     }
  343.     /**
  344.      * @return mixed
  345.      */
  346.     public function getEndAt()
  347.     {
  348.         return $this->endAt;
  349.     }
  350.     /**
  351.      * @param mixed $endAt
  352.      */
  353.     public function setEndAt($endAt): void
  354.     {
  355.         $this->endAt $endAt;
  356.     }
  357.     /**
  358.      * @return Entreprise|null
  359.      */
  360.     public function getMarchand(): ?Entreprise
  361.     {
  362.         return $this->marchand;
  363.     }
  364.     /**
  365.      * @param Entreprise|null $marchand
  366.      */
  367.     public function setMarchand(?Entreprise $marchand): void
  368.     {
  369.         $this->marchand $marchand;
  370.     }
  371.     /**
  372.      * @return string|null
  373.      */
  374.     public function getLocationUsage(): ?string
  375.     {
  376.         return $this->locationUsage;
  377.     }
  378.     /**
  379.      * @param string|null $locationUsage
  380.      */
  381.     public function setLocationUsage(?string $locationUsage): void
  382.     {
  383.         $this->locationUsage $locationUsage;
  384.     }
  385.     /**
  386.      * @return string|null
  387.      */
  388.     public function getDuree(): ?string
  389.     {
  390.         return $this->duree;
  391.     }
  392.     /**
  393.      * @param string|null $duree
  394.      */
  395.     public function setDuree(?string $duree): void
  396.     {
  397.         $this->duree $duree;
  398.     }
  399.     /**
  400.      * @return ArrayCollection|Collection
  401.      */
  402.     public function getContrat(): ArrayCollection|Collection
  403.     {
  404.         return $this->contrat;
  405.     }
  406.     /**
  407.      * @param ArrayCollection|Collection $contrat
  408.      */
  409.     public function setContrat(ArrayCollection|Collection $contrat): void
  410.     {
  411.         $this->contrat $contrat;
  412.     }
  413.     /**
  414.      * @return ArrayCollection|Collection
  415.      */
  416.     public function getPayments(): ArrayCollection|Collection
  417.     {
  418.         return $this->payments;
  419.     }
  420.     /**
  421.      * @param ArrayCollection|Collection $payments
  422.      */
  423.     public function setPayments(ArrayCollection|Collection $payments): void
  424.     {
  425.         $this->payments $payments;
  426.     }
  427.     public function __toString()
  428.     {
  429.         return $this->getLocataire()->getFirstname()." ".$this->getLocataire()->getName()." ".$this->getLocataire()->getLastname();
  430.     }
  431.     /**
  432.      * @return Collection<int, Incident>
  433.      */
  434.     public function getIncidents(): Collection
  435.     {
  436.         return $this->incidents;
  437.     }
  438.     public function addIncident(Incident $incident): static
  439.     {
  440.         if (!$this->incidents->contains($incident)) {
  441.             $this->incidents->add($incident);
  442.             $incident->setLocation($this);
  443.         }
  444.         return $this;
  445.     }
  446.     public function removeIncident(Incident $incident): static
  447.     {
  448.         if ($this->incidents->removeElement($incident)) {
  449.             // set the owning side to null (unless already changed)
  450.             if ($incident->getLocation() === $this) {
  451.                 $incident->setLocation(null);
  452.             }
  453.         }
  454.         return $this;
  455.     }
  456.     public function getPaymentPeriod(): ?string
  457.     {
  458.         return $this->paymentPeriod;
  459.     }
  460.     public function setPaymentPeriod(?string $paymentPeriod): static
  461.     {
  462.         $this->paymentPeriod $paymentPeriod;
  463.         return $this;
  464.     }
  465.     public function getTypeGaranty(): ?string
  466.     {
  467.         return $this->typeGaranty;
  468.     }
  469.     public function setTypeGaranty(?string $typeGaranty): static
  470.     {
  471.         $this->typeGaranty $typeGaranty;
  472.         return $this;
  473.     }
  474.     public function getReconduction(): ?string
  475.     {
  476.         return $this->reconduction;
  477.     }
  478.     public function setReconduction(?string $reconduction): static
  479.     {
  480.         $this->reconduction $reconduction;
  481.         return $this;
  482.     }
  483.     public function getGarantyTobepaid(): ?string
  484.     {
  485.         return $this->garantyTobepaid;
  486.     }
  487.     public function setGarantyTobepaid(?string $garantyTobepaid): static
  488.     {
  489.         $this->garantyTobepaid $garantyTobepaid;
  490.         return $this;
  491.     }
  492.     public function getMode(): ?string
  493.     {
  494.         return $this->mode;
  495.     }
  496.     public function setMode(?string $mode): static
  497.     {
  498.         $this->mode $mode;
  499.         return $this;
  500.     }
  501.     public function getUuid(): ?Uuid
  502.     {
  503.         return $this->uuid;
  504.     }
  505.     public function setUuid(Uuid $uuid): self
  506.     {
  507.         $this->uuid $uuid;
  508.         return $this;
  509.     }
  510.     public function isReserver(): ?bool
  511.     {
  512.         return $this->reserver;
  513.     }
  514.     public function setReserver(?bool $reserver): static
  515.     {
  516.         $this->reserver $reserver;
  517.         return $this;
  518.     }
  519.     public function getLocationType(): ?string
  520.     {
  521.         return $this->locationType;
  522.     }
  523.     public function setLocationType(?string $locationType): static
  524.     {
  525.         $this->locationType $locationType;
  526.         return $this;
  527.     }
  528.     public function getLastExpenseAmount(): ?string
  529.     {
  530.         return $this->lastExpenseAmount;
  531.     }
  532.     public function setLastExpenseAmount(?string $lastExpenseAmount): static
  533.     {
  534.         $this->lastExpenseAmount $lastExpenseAmount;
  535.         return $this;
  536.     }
  537.     /**
  538.      * @return Collection<int, ChargeAllocation>
  539.      */
  540.     public function getChargeAllocations(): Collection
  541.     {
  542.         return $this->chargeAllocations;
  543.     }
  544.     public function addChargeAllocation(ChargeAllocation $chargeAllocation): static
  545.     {
  546.         if (!$this->chargeAllocations->contains($chargeAllocation)) {
  547.             $this->chargeAllocations->add($chargeAllocation);
  548.             $chargeAllocation->setLocation($this);
  549.         }
  550.         return $this;
  551.     }
  552.     public function removeChargeAllocation(ChargeAllocation $chargeAllocation): static
  553.     {
  554.         if ($this->chargeAllocations->removeElement($chargeAllocation)) {
  555.             // set the owning side to null (unless already changed)
  556.             if ($chargeAllocation->getLocation() === $this) {
  557.                 $chargeAllocation->setLocation(null);
  558.             }
  559.         }
  560.         return $this;
  561.     }
  562.     public function getOccupants(): ?int
  563.     {
  564.         return $this->occupants;
  565.     }
  566.     public function setOccupants(?int $occupants): static
  567.     {
  568.         $this->occupants $occupants;
  569.         return $this;
  570.     }
  571.     /**
  572.      * @return Collection<int, Charge>
  573.      */
  574.     public function getCharges(): Collection
  575.     {
  576.         return $this->charges;
  577.     }
  578.     public function addCharge(Charge $charge): static
  579.     {
  580.         if (!$this->charges->contains($charge)) {
  581.             $this->charges->add($charge);
  582.             $charge->setLocation($this);
  583.         }
  584.         return $this;
  585.     }
  586.     public function removeCharge(Charge $charge): static
  587.     {
  588.         if ($this->charges->removeElement($charge)) {
  589.             // set the owning side to null (unless already changed)
  590.             if ($charge->getLocation() === $this) {
  591.                 $charge->setLocation(null);
  592.             }
  593.         }
  594.         return $this;
  595.     }
  596.     public function getResidence(): ?Residence
  597.     {
  598.         return $this->residence;
  599.     }
  600.     public function setResidence(?Residence $residence): static
  601.     {
  602.         $this->residence $residence;
  603.         return $this;
  604.     }
  605.     public function isIsTvaApply(): ?bool
  606.     {
  607.         return $this->isTvaApply;
  608.     }
  609.     public function setIsTvaApply(bool $isTvaApply): static
  610.     {
  611.         $this->isTvaApply $isTvaApply;
  612.         return $this;
  613.     }
  614.     public function getTva(): ?string
  615.     {
  616.         return $this->tva;
  617.     }
  618.     public function setTva(?string $tva): static
  619.     {
  620.         $this->tva $tva;
  621.         return $this;
  622.     }
  623. }