<?php
namespace App\Entity;
use App\Repository\VillesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: VillesRepository::class)]
class Villes
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column()]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $code = null;
#[ORM\Column(length: 255)]
private ?string $slug = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(nullable: true)]
private ?bool $status = null;
#[ORM\OneToMany(mappedBy: 'ville', targetEntity: Quartiers::class)]
private Collection $quartiers;
#[ORM\OneToMany(mappedBy: 'ville', targetEntity: Immeubles::class)]
private Collection $immeubles;
#[ORM\OneToMany(mappedBy: 'ville', targetEntity: Vehicules::class)]
private Collection $vehicules;
public function __construct()
{
$this->quartiers = new ArrayCollection();
$this->immeubles = new ArrayCollection();
$this->vehicules = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function isStatus(): ?bool
{
return $this->status;
}
public function setStatus(?bool $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, Quartiers>
*/
public function getQuartiers(): Collection
{
return $this->quartiers;
}
public function addQuartier(Quartiers $quartier): self
{
if (!$this->quartiers->contains($quartier)) {
$this->quartiers[] = $quartier;
$quartier->setVille($this);
}
return $this;
}
public function removeQuartier(Quartiers $quartier): self
{
if ($this->quartiers->removeElement($quartier)) {
// set the owning side to null (unless already changed)
if ($quartier->getVille() === $this) {
$quartier->setVille(null);
}
}
return $this;
}
/**
* @return Collection<int, Immeubles>
*/
public function getImmeubles(): Collection
{
return $this->immeubles;
}
public function addImmeuble(Immeubles $immeuble): self
{
if (!$this->immeubles->contains($immeuble)) {
$this->immeubles[] = $immeuble;
$immeuble->setVille($this);
}
return $this;
}
public function removeImmeuble(Immeubles $immeuble): self
{
if ($this->immeubles->removeElement($immeuble)) {
// set the owning side to null (unless already changed)
if ($immeuble->getVille() === $this) {
$immeuble->setVille(null);
}
}
return $this;
}
/**
* @return Collection<int, Vehicules>
*/
public function getVehicules(): Collection
{
return $this->vehicules;
}
public function addVehicule(Vehicules $vehicule): self
{
if (!$this->vehicules->contains($vehicule)) {
$this->vehicules[] = $vehicule;
$vehicule->setVille($this);
}
return $this;
}
public function removeVehicule(Vehicules $vehicule): self
{
if ($this->vehicules->removeElement($vehicule)) {
// set the owning side to null (unless already changed)
if ($vehicule->getVille() === $this) {
$vehicule->setVille(null);
}
}
return $this;
}
}