<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\StatutLivraisonRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: StatutLivraisonRepository::class)]
#[ApiResource]
class StatutLivraison
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $libelle = null;
#[ORM\OneToMany(mappedBy: 'statut_livraison', targetEntity: Livraisons::class)]
private Collection $livraisons;
public function __construct()
{
$this->livraisons = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle): static
{
$this->libelle = $libelle;
return $this;
}
/**
* @return Collection<int, Livraisons>
*/
public function getLivraisons(): Collection
{
return $this->livraisons;
}
public function addLivraison(Livraisons $livraison): static
{
if (!$this->livraisons->contains($livraison)) {
$this->livraisons->add($livraison);
$livraison->setStatutLivraison($this);
}
return $this;
}
public function removeLivraison(Livraisons $livraison): static
{
if ($this->livraisons->removeElement($livraison)) {
// set the owning side to null (unless already changed)
if ($livraison->getStatutLivraison() === $this) {
$livraison->setStatutLivraison(null);
}
}
return $this;
}
public function __toString(): string
{
return $this->libelle; // Return a string representation
}
}