80 lines
1.8 KiB
PHP
80 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\EtatRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: EtatRepository::class)]
|
|
class Etat
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\Column(type: 'guid', unique: true)]
|
|
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
|
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
|
|
private ?string $idEtat = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $libelle = null;
|
|
|
|
/**
|
|
* @var Collection<int, Sortie>
|
|
*/
|
|
#[ORM\OneToMany(targetEntity: Sortie::class, mappedBy: 'etat')]
|
|
private Collection $sorties;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->sorties = new ArrayCollection();
|
|
}
|
|
|
|
public function getIdEtat(): ?string // Changement ici
|
|
{
|
|
return $this->idEtat;
|
|
}
|
|
|
|
public function getLibelle(): ?string
|
|
{
|
|
return $this->libelle;
|
|
}
|
|
|
|
public function setLibelle(string $libelle): self
|
|
{
|
|
$this->libelle = $libelle;
|
|
|
|
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->setEtat($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->getEtat() === $this) {
|
|
$sortie->setEtat(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|