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.     public function __construct()
  93.     {
  94.         $this->paymentGaranties = new ArrayCollection();
  95.         $this->contrat = new ArrayCollection();
  96.         $this->payments = new ArrayCollection();
  97.         $this->incidents = new ArrayCollection();
  98.         $this->chargeAllocations = new ArrayCollection();
  99.         $this->charges = new ArrayCollection();
  100.     }
  101.     /**
  102.      * @return int|null
  103.      */
  104.     public function getId(): ?int
  105.     {
  106.         return $this->id;
  107.     }
  108.     /**
  109.      * @param int|null $id
  110.      */
  111.     public function setId(?int $id): void
  112.     {
  113.         $this->id $id;
  114.     }
  115.     /**
  116.      * @return string|null
  117.      */
  118.     public function getCode(): ?string
  119.     {
  120.         return $this->code;
  121.     }
  122.     /**
  123.      * @param string|null $code
  124.      */
  125.     public function setCode(?string $code): void
  126.     {
  127.         $this->code $code;
  128.     }
  129.     /**
  130.      * @return Locataire|null
  131.      */
  132.     public function getLocataire(): ?Locataire
  133.     {
  134.         return $this->locataire;
  135.     }
  136.     /**
  137.      * @param Locataire|null $locataire
  138.      */
  139.     public function setLocataire(?Locataire $locataire): void
  140.     {
  141.         $this->locataire $locataire;
  142.     }
  143.     /**
  144.      * @return Habitat|null
  145.      */
  146.     public function getHabitat(): ?Habitat
  147.     {
  148.         return $this->habitat;
  149.     }
  150.     /**
  151.      * @param Habitat|null $habitat
  152.      */
  153.     public function setHabitat(?Habitat $habitat): void
  154.     {
  155.         $this->habitat $habitat;
  156.     }
  157.     /**
  158.      * @return User|null
  159.      */
  160.     public function getCreatedBy(): ?User
  161.     {
  162.         return $this->createdBy;
  163.     }
  164.     /**
  165.      * @param User|null $createdBy
  166.      */
  167.     public function setCreatedBy(?User $createdBy): void
  168.     {
  169.         $this->createdBy $createdBy;
  170.     }
  171.     /**
  172.      * @return bool|null
  173.      */
  174.     public function getStatus(): ?bool
  175.     {
  176.         return $this->status;
  177.     }
  178.     /**
  179.      * @param bool|null $status
  180.      */
  181.     public function setStatus(?bool $status): void
  182.     {
  183.         $this->status $status;
  184.     }
  185.     /**
  186.      * @return bool|null
  187.      */
  188.     public function getOccuper(): ?bool
  189.     {
  190.         return $this->occuper;
  191.     }
  192.     /**
  193.      * @param bool|null $occuper
  194.      */
  195.     public function setOccuper(?bool $occuper): void
  196.     {
  197.         $this->occuper $occuper;
  198.     }
  199.     /**
  200.      * @return string|null
  201.      */
  202.     public function getCommentaire(): ?string
  203.     {
  204.         return $this->commentaire;
  205.     }
  206.     /**
  207.      * @param string|null $commentaire
  208.      */
  209.     public function setCommentaire(?string $commentaire): void
  210.     {
  211.         $this->commentaire $commentaire;
  212.     }
  213.     /**
  214.      * @return string|null
  215.      */
  216.     public function getGaranty(): ?string
  217.     {
  218.         return $this->garanty;
  219.     }
  220.     /**
  221.      * @param string|null $garanty
  222.      */
  223.     public function setGaranty(?string $garanty): void
  224.     {
  225.         $this->garanty $garanty;
  226.     }
  227.     /**
  228.      * @return ArrayCollection|Collection
  229.      */
  230.     public function getPaymentGaranties(): ArrayCollection|Collection
  231.     {
  232.         return $this->paymentGaranties;
  233.     }
  234.     /**
  235.      * @param ArrayCollection|Collection $paymentGaranties
  236.      */
  237.     public function setPaymentGaranties(ArrayCollection|Collection $paymentGaranties): void
  238.     {
  239.         $this->paymentGaranties $paymentGaranties;
  240.     }
  241.     /**
  242.      * @return string|null
  243.      */
  244.     public function getMaxGaranty(): ?string
  245.     {
  246.         return $this->maxGaranty;
  247.     }
  248.     /**
  249.      * @param string|null $maxGaranty
  250.      */
  251.     public function setMaxGaranty(?string $maxGaranty): void
  252.     {
  253.         $this->maxGaranty $maxGaranty;
  254.     }
  255.     /**
  256.      * @return string|null
  257.      */
  258.     public function getPaymentDueDate(): ?string
  259.     {
  260.         return $this->paymentDueDate;
  261.     }
  262.     /**
  263.      * @param string|null $paymentDueDate
  264.      */
  265.     public function setPaymentDueDate(?string $paymentDueDate): void
  266.     {
  267.         $this->paymentDueDate $paymentDueDate;
  268.     }
  269.     /**
  270.      * @return string|null
  271.      */
  272.     public function getPrice(): ?string
  273.     {
  274.         return $this->price;
  275.     }
  276.     /**
  277.      * @param string|null $price
  278.      */
  279.     public function setPrice(?string $price): void
  280.     {
  281.         $this->price $price;
  282.     }
  283.     /**
  284.      * @return mixed
  285.      */
  286.     public function getEndLocationAt()
  287.     {
  288.         return $this->endLocationAt;
  289.     }
  290.     /**
  291.      * @param mixed $endLocationAt
  292.      */
  293.     public function setEndLocationAt($endLocationAt): void
  294.     {
  295.         $this->endLocationAt $endLocationAt;
  296.     }
  297.     /**
  298.      * @return string|null
  299.      */
  300.     public function getCommentaire2(): ?string
  301.     {
  302.         return $this->commentaire2;
  303.     }
  304.     /**
  305.      * @param string|null $commentaire2
  306.      */
  307.     public function setCommentaire2(?string $commentaire2): void
  308.     {
  309.         $this->commentaire2 $commentaire2;
  310.     }
  311.     /**
  312.      * @return string|null
  313.      */
  314.     public function getType(): ?string
  315.     {
  316.         return $this->type;
  317.     }
  318.     /**
  319.      * @param string|null $type
  320.      */
  321.     public function setType(?string $type): void
  322.     {
  323.         $this->type $type;
  324.     }
  325.     /**
  326.      * @return mixed
  327.      */
  328.     public function getStartAt()
  329.     {
  330.         return $this->startAt;
  331.     }
  332.     /**
  333.      * @param mixed $startAt
  334.      */
  335.     public function setStartAt($startAt): void
  336.     {
  337.         $this->startAt $startAt;
  338.     }
  339.     /**
  340.      * @return mixed
  341.      */
  342.     public function getEndAt()
  343.     {
  344.         return $this->endAt;
  345.     }
  346.     /**
  347.      * @param mixed $endAt
  348.      */
  349.     public function setEndAt($endAt): void
  350.     {
  351.         $this->endAt $endAt;
  352.     }
  353.     /**
  354.      * @return Entreprise|null
  355.      */
  356.     public function getMarchand(): ?Entreprise
  357.     {
  358.         return $this->marchand;
  359.     }
  360.     /**
  361.      * @param Entreprise|null $marchand
  362.      */
  363.     public function setMarchand(?Entreprise $marchand): void
  364.     {
  365.         $this->marchand $marchand;
  366.     }
  367.     /**
  368.      * @return string|null
  369.      */
  370.     public function getLocationUsage(): ?string
  371.     {
  372.         return $this->locationUsage;
  373.     }
  374.     /**
  375.      * @param string|null $locationUsage
  376.      */
  377.     public function setLocationUsage(?string $locationUsage): void
  378.     {
  379.         $this->locationUsage $locationUsage;
  380.     }
  381.     /**
  382.      * @return string|null
  383.      */
  384.     public function getDuree(): ?string
  385.     {
  386.         return $this->duree;
  387.     }
  388.     /**
  389.      * @param string|null $duree
  390.      */
  391.     public function setDuree(?string $duree): void
  392.     {
  393.         $this->duree $duree;
  394.     }
  395.     /**
  396.      * @return ArrayCollection|Collection
  397.      */
  398.     public function getContrat(): ArrayCollection|Collection
  399.     {
  400.         return $this->contrat;
  401.     }
  402.     /**
  403.      * @param ArrayCollection|Collection $contrat
  404.      */
  405.     public function setContrat(ArrayCollection|Collection $contrat): void
  406.     {
  407.         $this->contrat $contrat;
  408.     }
  409.     /**
  410.      * @return ArrayCollection|Collection
  411.      */
  412.     public function getPayments(): ArrayCollection|Collection
  413.     {
  414.         return $this->payments;
  415.     }
  416.     /**
  417.      * @param ArrayCollection|Collection $payments
  418.      */
  419.     public function setPayments(ArrayCollection|Collection $payments): void
  420.     {
  421.         $this->payments $payments;
  422.     }
  423.     public function __toString()
  424.     {
  425.         return $this->getLocataire()->getFirstname()." ".$this->getLocataire()->getName()." ".$this->getLocataire()->getLastname();
  426.     }
  427.     /**
  428.      * @return Collection<int, Incident>
  429.      */
  430.     public function getIncidents(): Collection
  431.     {
  432.         return $this->incidents;
  433.     }
  434.     public function addIncident(Incident $incident): static
  435.     {
  436.         if (!$this->incidents->contains($incident)) {
  437.             $this->incidents->add($incident);
  438.             $incident->setLocation($this);
  439.         }
  440.         return $this;
  441.     }
  442.     public function removeIncident(Incident $incident): static
  443.     {
  444.         if ($this->incidents->removeElement($incident)) {
  445.             // set the owning side to null (unless already changed)
  446.             if ($incident->getLocation() === $this) {
  447.                 $incident->setLocation(null);
  448.             }
  449.         }
  450.         return $this;
  451.     }
  452.     public function getPaymentPeriod(): ?string
  453.     {
  454.         return $this->paymentPeriod;
  455.     }
  456.     public function setPaymentPeriod(?string $paymentPeriod): static
  457.     {
  458.         $this->paymentPeriod $paymentPeriod;
  459.         return $this;
  460.     }
  461.     public function getTypeGaranty(): ?string
  462.     {
  463.         return $this->typeGaranty;
  464.     }
  465.     public function setTypeGaranty(?string $typeGaranty): static
  466.     {
  467.         $this->typeGaranty $typeGaranty;
  468.         return $this;
  469.     }
  470.     public function getReconduction(): ?string
  471.     {
  472.         return $this->reconduction;
  473.     }
  474.     public function setReconduction(?string $reconduction): static
  475.     {
  476.         $this->reconduction $reconduction;
  477.         return $this;
  478.     }
  479.     public function getGarantyTobepaid(): ?string
  480.     {
  481.         return $this->garantyTobepaid;
  482.     }
  483.     public function setGarantyTobepaid(?string $garantyTobepaid): static
  484.     {
  485.         $this->garantyTobepaid $garantyTobepaid;
  486.         return $this;
  487.     }
  488.     public function getMode(): ?string
  489.     {
  490.         return $this->mode;
  491.     }
  492.     public function setMode(?string $mode): static
  493.     {
  494.         $this->mode $mode;
  495.         return $this;
  496.     }
  497.     public function getUuid(): ?Uuid
  498.     {
  499.         return $this->uuid;
  500.     }
  501.     public function setUuid(Uuid $uuid): self
  502.     {
  503.         $this->uuid $uuid;
  504.         return $this;
  505.     }
  506.     public function isReserver(): ?bool
  507.     {
  508.         return $this->reserver;
  509.     }
  510.     public function setReserver(?bool $reserver): static
  511.     {
  512.         $this->reserver $reserver;
  513.         return $this;
  514.     }
  515.     public function getLocationType(): ?string
  516.     {
  517.         return $this->locationType;
  518.     }
  519.     public function setLocationType(?string $locationType): static
  520.     {
  521.         $this->locationType $locationType;
  522.         return $this;
  523.     }
  524.     public function getLastExpenseAmount(): ?string
  525.     {
  526.         return $this->lastExpenseAmount;
  527.     }
  528.     public function setLastExpenseAmount(?string $lastExpenseAmount): static
  529.     {
  530.         $this->lastExpenseAmount $lastExpenseAmount;
  531.         return $this;
  532.     }
  533.     /**
  534.      * @return Collection<int, ChargeAllocation>
  535.      */
  536.     public function getChargeAllocations(): Collection
  537.     {
  538.         return $this->chargeAllocations;
  539.     }
  540.     public function addChargeAllocation(ChargeAllocation $chargeAllocation): static
  541.     {
  542.         if (!$this->chargeAllocations->contains($chargeAllocation)) {
  543.             $this->chargeAllocations->add($chargeAllocation);
  544.             $chargeAllocation->setLocation($this);
  545.         }
  546.         return $this;
  547.     }
  548.     public function removeChargeAllocation(ChargeAllocation $chargeAllocation): static
  549.     {
  550.         if ($this->chargeAllocations->removeElement($chargeAllocation)) {
  551.             // set the owning side to null (unless already changed)
  552.             if ($chargeAllocation->getLocation() === $this) {
  553.                 $chargeAllocation->setLocation(null);
  554.             }
  555.         }
  556.         return $this;
  557.     }
  558.     public function getOccupants(): ?int
  559.     {
  560.         return $this->occupants;
  561.     }
  562.     public function setOccupants(?int $occupants): static
  563.     {
  564.         $this->occupants $occupants;
  565.         return $this;
  566.     }
  567.     /**
  568.      * @return Collection<int, Charge>
  569.      */
  570.     public function getCharges(): Collection
  571.     {
  572.         return $this->charges;
  573.     }
  574.     public function addCharge(Charge $charge): static
  575.     {
  576.         if (!$this->charges->contains($charge)) {
  577.             $this->charges->add($charge);
  578.             $charge->setLocation($this);
  579.         }
  580.         return $this;
  581.     }
  582.     public function removeCharge(Charge $charge): static
  583.     {
  584.         if ($this->charges->removeElement($charge)) {
  585.             // set the owning side to null (unless already changed)
  586.             if ($charge->getLocation() === $this) {
  587.                 $charge->setLocation(null);
  588.             }
  589.         }
  590.         return $this;
  591.     }
  592.     public function getResidence(): ?Residence
  593.     {
  594.         return $this->residence;
  595.     }
  596.     public function setResidence(?Residence $residence): static
  597.     {
  598.         $this->residence $residence;
  599.         return $this;
  600.     }
  601. }