Files
ENI-sortir/src/Entity/Lieu.php
2024-11-19 10:36:49 +01:00

141 lines
2.9 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\LieuRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LieuRepository::class)]
class Lieu
{
#[ORM\Id]
#[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?string $idLieu = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $rue = null;
#[ORM\Column(nullable: true)]
private ?float $latitude = null;
#[ORM\Column(nullable: true)]
private ?float $longitude = null;
/**
* @var Collection<int, Sortie>
*/
#[ORM\OneToMany(targetEntity: Sortie::class, mappedBy: 'lieu')]
private Collection $sorties;
#[ORM\ManyToOne(inversedBy: 'lieux')]
#[ORM\JoinColumn(name: 'ville_id', referencedColumnName: 'idVille', nullable: false)]
private ?Ville $ville = null;
public function __construct()
{
$this->sorties = new ArrayCollection();
}
public function getIdLieu(): ?string
{
return $this->idLieu;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getRue(): ?string
{
return $this->rue;
}
public function setRue(?string $rue): self
{
$this->rue = $rue;
return $this;
}
public function getLatitude(): ?float
{
return $this->latitude;
}
public function setLatitude(?float $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?float
{
return $this->longitude;
}
public function setLongitude(?float $longitude): self
{
$this->longitude = $longitude;
return $this;
}
/**
* @return Collection<int, Sortie>
*/
public function getSorties(): Collection
{
return $this->sorties;
}
public function addSortie(Sortie $sortie): self
{
if (!$this->sorties->contains($sortie)) {
$this->sorties->add($sortie);
$sortie->setLieu($this);
}
return $this;
}
public function removeSortie(Sortie $sortie): self
{
if ($this->sorties->removeElement($sortie)) {
// Set the owning side to null (unless already changed)
if ($sortie->getLieu() === $this) {
$sortie->setLieu(null);
}
}
return $this;
}
public function getVille(): ?Ville
{
return $this->ville;
}
public function setVille(?Ville $ville): self
{
$this->ville = $ville;
return $this;
}
}