src\Entity\CategorieVideo.php line 11

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