src\Entity\CategorieFormation.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\CategorieFormationRepository::class)]
  7. class CategorieFormation
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[ORM\Column(type'string'length255)]
  14.     private $titre;
  15.     #[ORM\Column(type'text'nullabletrue)]
  16.     private $description;
  17.     #[ORM\ManyToMany(targetEntity\App\Entity\Formation::class, mappedBy'categorie')]
  18.     private $formations;
  19.     #[ORM\Column(type'string'length255)]
  20.     private $slug;
  21.     public function __construct()
  22.     {
  23.         $this->formations = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getTitre(): ?string
  30.     {
  31.         return $this->titre;
  32.     }
  33.     public function setTitre(string $titre): self
  34.     {
  35.         $this->titre $titre;
  36.         return $this;
  37.     }
  38.     public function getDescription(): ?string
  39.     {
  40.         return $this->description;
  41.     }
  42.     public function setDescription(?string $description): self
  43.     {
  44.         $this->description $description;
  45.         return $this;
  46.     }
  47.     /**
  48.      * @return Collection|Formation[]
  49.      */
  50.     public function getFormations(): Collection
  51.     {
  52.         return $this->formations;
  53.     }
  54.     public function addFormation(Formation $formation): self
  55.     {
  56.         if (!$this->formations->contains($formation)) {
  57.             $this->formations[] = $formation;
  58.             $formation->addCategorie($this);
  59.         }
  60.         return $this;
  61.     }
  62.     public function removeFormation(Formation $formation): self
  63.     {
  64.         if ($this->formations->contains($formation)) {
  65.             $this->formations->removeElement($formation);
  66.             $formation->removeCategorie($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function getSlug(): ?string
  71.     {
  72.         return $this->slug;
  73.     }
  74.     public function setSlug(string $slug): self
  75.     {
  76.         $this->slug $slug;
  77.         return $this;
  78.     }
  79. }