src\Entity\Categorie.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClass\App\Repository\CategorieRepository::class)]
  7. class Categorie
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[ORM\Column(type'string'length255)]
  14.     private $libelle_categorie;
  15.     #[ORM\OneToMany(targetEntity\App\Entity\Evenement::class, mappedBy'categorie'orphanRemovaltrue)]
  16.     private $evenements;
  17.     public function __construct()
  18.     {
  19.         $this->evenements = new ArrayCollection();
  20.     }
  21.     public function getId(): ?int
  22.     {
  23.         return $this->id;
  24.     }
  25.     public function getLibelleCategorie(): ?string
  26.     {
  27.         return $this->libelle_categorie;
  28.     }
  29.     public function setLibelleCategorie(string $libelle_categorie): self
  30.     {
  31.         $this->libelle_categorie $libelle_categorie;
  32.         return $this;
  33.     }
  34.     /**
  35.      * @return Collection|Evenement[]
  36.      */
  37.     public function getEvenements(): Collection
  38.     {
  39.         return $this->evenements;
  40.     }
  41.     public function addEvenement(Evenement $evenement): self
  42.     {
  43.         if (!$this->evenements->contains($evenement)) {
  44.             $this->evenements[] = $evenement;
  45.             $evenement->setCategorie($this);
  46.         }
  47.         return $this;
  48.     }
  49.     public function removeEvenement(Evenement $evenement): self
  50.     {
  51.         if ($this->evenements->contains($evenement)) {
  52.             $this->evenements->removeElement($evenement);
  53.             // set the owning side to null (unless already changed)
  54.             if ($evenement->getCategorie() === $this) {
  55.                 $evenement->setCategorie(null);
  56.             }
  57.         }
  58.         return $this;
  59.     }
  60. }