src/Entity/TutorialCategory.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TutorialCategoryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassTutorialCategoryRepository::class)]
  8. class TutorialCategory
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $title;
  16.     #[ORM\Column(type'string'length255)]
  17.     private $slug;
  18.     #[ORM\ManyToMany(targetEntityTutorial::class, inversedBy'categories')]
  19.     private $tutorials;
  20.     public function __construct()
  21.     {
  22.         $this->tutorials = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getTitle(): ?string
  29.     {
  30.         return $this->title;
  31.     }
  32.     public function setTitle(string $title): self
  33.     {
  34.         $this->title $title;
  35.         return $this;
  36.     }
  37.     public function getSlug(): ?string
  38.     {
  39.         return $this->slug;
  40.     }
  41.     public function setSlug(string $slug): self
  42.     {
  43.         $this->slug $slug;
  44.         return $this;
  45.     }
  46.     /**
  47.      * @return Collection|Tutorial[]
  48.      */
  49.     public function getTutorials(): Collection
  50.     {
  51.         return $this->tutorials;
  52.     }
  53.     public function addTutorial(Tutorial $tutorial): self
  54.     {
  55.         if (!$this->tutorials->contains($tutorial)) {
  56.             $this->tutorials[] = $tutorial;
  57.         }
  58.         return $this;
  59.     }
  60.     public function removeTutorial(Tutorial $tutorial): self
  61.     {
  62.         $this->tutorials->removeElement($tutorial);
  63.         return $this;
  64.     }
  65. }