This commit is contained in:
marvin
2024-11-18 16:39:14 +01:00
parent e0935ec69d
commit 2131abdd5f
12 changed files with 932 additions and 138 deletions

81
src/Entity/Etat.php Normal file
View File

@@ -0,0 +1,81 @@
<?php
namespace App\Entity;
use App\Repository\EtatRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: EtatRepository::class)]
class Etat
{
#[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $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->idEtat = Uuid::v4(); // Génération automatique d'un UUID
$this->sorties = new ArrayCollection();
}
public function getIdEtat(): ?Uuid
{
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;
}
}