src/Entity/FaqCategory.php line 13
<?php
namespace App\Entity;
use App\Repository\FaqCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
#[ORM\Entity(repositoryClass: FaqCategoryRepository::class)]
#[ORM\Table(name: '`faq_categories`')]
class FaqCategory
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 50)]
private ?string $title = null;
#[ORM\OneToMany(mappedBy: 'faq_category', targetEntity: Faq::class, cascade: ['ALL'])]
private Collection $faqs;
public function __construct()
{
$this->faqs = 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;
}
/**
* @return Collection<int, Faq>
*/
public function getFaqs(): Collection
{
return $this->faqs;
}
public function addFaq(Faq $faq): self
{
if (!$this->faqs->contains($faq)) {
$this->faqs->add($faq);
$faq->setFaqCategory($this);
}
return $this;
}
public function removeFaq(Faq $faq): self
{
if ($this->faqs->removeElement($faq)) {
// set the owning side to null (unless already changed)
if ($faq->getFaqCategory() === $this) {
$faq->setFaqCategory(null);
}
}
return $this;
}
}