src/Entity/StatutLivraison.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\StatutLivraisonRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassStatutLivraisonRepository::class)]
  9. #[ApiResource]
  10. class StatutLivraison
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $libelle null;
  18.     #[ORM\OneToMany(mappedBy'statut_livraison'targetEntityLivraisons::class)]
  19.     private Collection $livraisons;
  20.     public function __construct()
  21.     {
  22.         $this->livraisons = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getLibelle(): ?string
  29.     {
  30.         return $this->libelle;
  31.     }
  32.     public function setLibelle(string $libelle): static
  33.     {
  34.         $this->libelle $libelle;
  35.         return $this;
  36.     }
  37.     /**
  38.      * @return Collection<int, Livraisons>
  39.      */
  40.     public function getLivraisons(): Collection
  41.     {
  42.         return $this->livraisons;
  43.     }
  44.     public function addLivraison(Livraisons $livraison): static
  45.     {
  46.         if (!$this->livraisons->contains($livraison)) {
  47.             $this->livraisons->add($livraison);
  48.             $livraison->setStatutLivraison($this);
  49.         }
  50.         return $this;
  51.     }
  52.     public function removeLivraison(Livraisons $livraison): static
  53.     {
  54.         if ($this->livraisons->removeElement($livraison)) {
  55.             // set the owning side to null (unless already changed)
  56.             if ($livraison->getStatutLivraison() === $this) {
  57.                 $livraison->setStatutLivraison(null);
  58.             }
  59.         }
  60.         return $this;
  61.     }
  62.     public function __toString(): string
  63.     {
  64.         return $this->libelle// Return a string representation
  65.     }
  66. }