<?php
namespace App\Entity;
use App\Repository\TutorialCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TutorialCategoryRepository::class)]
class TutorialCategory
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $title;
#[ORM\Column(type: 'string', length: 255)]
private $slug;
#[ORM\ManyToMany(targetEntity: Tutorial::class, inversedBy: 'categories')]
private $tutorials;
public function __construct()
{
$this->tutorials = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection|Tutorial[]
*/
public function getTutorials(): Collection
{
return $this->tutorials;
}
public function addTutorial(Tutorial $tutorial): self
{
if (!$this->tutorials->contains($tutorial)) {
$this->tutorials[] = $tutorial;
}
return $this;
}
public function removeTutorial(Tutorial $tutorial): self
{
$this->tutorials->removeElement($tutorial);
return $this;
}
}