src/Entity/Residence.php line 15
<?phpnamespace App\Entity;use App\Repository\ResidenceRepository;use App\Traits\TimeStampTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: ResidenceRepository::class)]#[ORM\HasLifecycleCallbacks]class Residence{use TimeStampTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]private $id;#[ORM\Column(length: 100)]private ?string $code = null;#[ORM\Column(length: 100, nullable: true)]private ?string $libelle = null;#[ORM\ManyToOne(inversedBy: 'residences')]private ?User $createdBy = null;#[ORM\Column(length: 255)]private ?string $adress = null;#[ORM\Column(nullable: true)]private ?bool $status = null;#[ORM\OneToMany(mappedBy: 'residence', targetEntity: Habitat::class, cascade: ['all'], fetch: 'EAGER')]private Collection $habitats;#[ORM\Column(length: 100, nullable: true)]private ?string $number = null;#[ORM\Column(length: 100, nullable: true)]private ?string $commune = null;#[ORM\Column(length: 100, nullable: true)]private ?string $ville = null;#[ORM\ManyToOne(inversedBy: 'residences')]private ?Entreprise $marchand = null;#[ORM\OneToMany(mappedBy: 'residence', targetEntity: Photos::class)]private Collection $photos;#[ORM\ManyToMany(targetEntity: ResidenceDetails::class, inversedBy: 'residences')]private Collection $details;#[ORM\ManyToMany(targetEntity: CategoryResidence::class, inversedBy: 'residences')]private Collection $category;#[ORM\ManyToOne(inversedBy: 'residences')]private ?ResidenceImmeuble $immeuble = null;#[ORM\OneToMany(mappedBy: 'residence', targetEntity: ResidenceImmeuble::class)]private Collection $residenceImmeubles;#[ORM\ManyToOne(inversedBy: 'residences')]#[Assert\NotBlank(message: 'Veuillez renseigner ce champ')]private ?Country $country = null;#[ORM\ManyToOne(inversedBy: 'residences')]#[Assert\NotBlank(message: 'Veuillez renseigner ce champ')]private ?Province $province = null;#[ORM\OneToMany(mappedBy: 'residence', targetEntity: Incident::class)]private Collection $incidents;#[ORM\Column(length: 255, nullable: true)]private ?string $pointdereference = null;#[ORM\Column(length: 50, nullable: true)]private ?string $codepostal = null;#[ORM\OneToMany(mappedBy: 'residence', targetEntity: Charge::class)]private Collection $charges;#[ORM\OneToMany(mappedBy: 'residence', targetEntity: Location::class)]private Collection $locations;public function __construct(){$this->habitats = new ArrayCollection();$this->category = new ArrayCollection();$this->photos = new ArrayCollection();$this->details = new ArrayCollection();$this->residenceImmeubles = new ArrayCollection();$this->incidents = new ArrayCollection();$this->charges = new ArrayCollection();$this->locations = new ArrayCollection();}/*** Set id.** @param int $id** @return Residence*/public function setId($id): static{$this->id = $id;return $this;}public function getId(){return $this->id;}/*** @return string|null*/public function getCode(): ?string{return $this->code;}/*** @param string|null $code*/public function setCode(?string $code): void{$this->code = $code;}/*** @return string|null*/public function getLibelle(): ?string{return $this->libelle;}/*** @param string|null $libelle*/public function setLibelle(?string $libelle): void{$this->libelle = $libelle;}/*** @return User|null*/public function getCreatedBy(): ?User{return $this->createdBy;}/*** @param User|null $createdBy*/public function setCreatedBy(?User $createdBy): void{$this->createdBy = $createdBy;}/*** @return string|null*/public function getAdress(): ?string{return $this->adress;}/*** @param string|null $adress*/public function setAdress(?string $adress): void{$this->adress = $adress;}/*** @return bool|null*/public function getStatus(): ?bool{return $this->status;}/*** @param bool|null $status*/public function setStatus(?bool $status): void{$this->status = $status;}/*** @return ArrayCollection|Collection*/public function getHabitats(): ArrayCollection|Collection{return $this->habitats;}/*** @param ArrayCollection|Collection $habitats*/public function setHabitats(ArrayCollection|Collection $habitats): void{$this->habitats = $habitats;}/*** @return string|null*/public function getNumber(): ?string{return $this->number;}/*** @param string|null $number*/public function setNumber(?string $number): void{$this->number = $number;}/*** @return string|null*/public function getCommune(): ?string{return $this->commune;}/*** @param string|null $commune*/public function setCommune(?string $commune): void{$this->commune = $commune;}/*** @return string|null*/public function getVille(): ?string{return $this->ville;}/*** @param string|null $ville*/public function setVille(?string $ville): void{$this->ville = $ville;}/*** @return Entreprise|null*/public function getMarchand(): ?Entreprise{return $this->marchand;}/*** @param Entreprise|null $marchand*/public function setMarchand(?Entreprise $marchand): void{$this->marchand = $marchand;}/*** @return ArrayCollection|Collection*/public function getPhotos(): ArrayCollection|Collection{return $this->photos;}/*** @param ArrayCollection|Collection $photos*/public function setPhotos(ArrayCollection|Collection $photos): void{$this->photos = $photos;}public function __toString(){return $this->libelle;}/*** @return Collection<int, ResidenceDetails>*/public function getDetails(): Collection{return $this->details;}public function addDetail(ResidenceDetails $detail): static{if (!$this->details->contains($detail)) {$this->details->add($detail);}return $this;}public function removeDetail(ResidenceDetails $detail): static{$this->details->removeElement($detail);return $this;}/*** @return Collection<int, CategoryResidence>*/public function getCategory(): Collection{return $this->category;}public function addCategory(CategoryResidence $category): static{if (!$this->category->contains($category)) {$this->category->add($category);}return $this;}public function removeCategory(CategoryResidence $category): static{$this->category->removeElement($category);return $this;}public function getImmeuble(): ?ResidenceImmeuble{return $this->immeuble;}public function setImmeuble(?ResidenceImmeuble $immeuble): static{$this->immeuble = $immeuble;return $this;}/*** @return Collection<int, ResidenceImmeuble>*/public function getResidenceImmeubles(): Collection{return $this->residenceImmeubles;}public function addResidenceImmeuble(ResidenceImmeuble $residenceImmeuble): static{if (!$this->residenceImmeubles->contains($residenceImmeuble)) {$this->residenceImmeubles->add($residenceImmeuble);$residenceImmeuble->setResidence($this);}return $this;}public function removeResidenceImmeuble(ResidenceImmeuble $residenceImmeuble): static{if ($this->residenceImmeubles->removeElement($residenceImmeuble)) {// set the owning side to null (unless already changed)if ($residenceImmeuble->getResidence() === $this) {$residenceImmeuble->setResidence(null);}}return $this;}public function getCountry(): ?Country{return $this->country;}public function setCountry(?Country $country): static{$this->country = $country;return $this;}public function getProvince(): ?Province{return $this->province;}public function setProvince(?Province $province): static{$this->province = $province;return $this;}/*** @return Collection<int, Incident>*/public function getIncidents(): Collection{return $this->incidents;}public function addIncident(Incident $incident): static{if (!$this->incidents->contains($incident)) {$this->incidents->add($incident);$incident->setResidence($this);}return $this;}public function removeIncident(Incident $incident): static{if ($this->incidents->removeElement($incident)) {// set the owning side to null (unless already changed)if ($incident->getResidence() === $this) {$incident->setResidence(null);}}return $this;}public function getPointdereference(): ?string{return $this->pointdereference;}public function setPointdereference(?string $pointdereference): static{$this->pointdereference = $pointdereference;return $this;}public function getCodepostal(): ?string{return $this->codepostal;}public function setCodepostal(?string $codepostal): static{$this->codepostal = $codepostal;return $this;}/*** @return Collection<int, Charge>*/public function getCharges(): Collection{return $this->charges;}public function addCharge(Charge $charge): static{if (!$this->charges->contains($charge)) {$this->charges->add($charge);$charge->setResidence($this);}return $this;}public function removeCharge(Charge $charge): static{if ($this->charges->removeElement($charge)) {// set the owning side to null (unless already changed)if ($charge->getResidence() === $this) {$charge->setResidence(null);}}return $this;}/*** @return Collection<int, Location>*/public function getLocations(): Collection{return $this->locations;}public function addLocation(Location $location): static{if (!$this->locations->contains($location)) {$this->locations->add($location);$location->setResidence($this);}return $this;}public function removeLocation(Location $location): static{if ($this->locations->removeElement($location)) {// set the owning side to null (unless already changed)if ($location->getResidence() === $this) {$location->setResidence(null);}}return $this;}}