src/Entity/FaqCategory.php line 19
- <?php
- namespace App\Entity;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\ArrayCollection;
- use Symfony\Component\Validator\Constraints as Assert;
- use Knp\DoctrineBehaviors\Model\Sluggable\SluggableTrait;
- use Knp\DoctrineBehaviors\Contract\Entity\SluggableInterface;
- /**
- * Category
- *
- * @ORM\Table(name="faq_category")
- * @ORM\Entity(repositoryClass="App\Repository\FaqCategoryRepository")
- */
- class FaqCategory // implements SluggableInterface
- {
- // use SluggableTrait;
- /**
- * @var integer
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(name="name", type="string", length=255)
- */
- private $name;
- /**
- * @var integer
- *
- * @ORM\Column(name="list_order", type="integer")
- */
- private $listOrder = 1;
- /**
- * @var boolean
- *
- * @ORM\Column(name="active", type="boolean")
- */
- private $active;
- /**
- * @var string
- *
- * @ORM\Column(name="idioma", type="string", length=255, nullable=true)
- */
- private $idioma="es";
- /**
- * @var Collection
- * @ORM\OneToMany(targetEntity="Faq", mappedBy="category" , cascade={"persist"}, orphanRemoval=true)
- */
- protected $faqs;
- /**
- * @var string
- *
- * @ORM\Column(name="slug", type="string", length=255, nullable=true)
- */
- private $slug;
- public function __construct()
- {
- $this->items = new ArrayCollection();
- $this->faqs = new ArrayCollection();
- }
- public function __toString()
- {
- return $this->name;
- }
- public function getSluggableFields(): array
- {
- return ['name'];
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getName(): ?string
- {
- return $this->name;
- }
- public function setName(string $name): self
- {
- $this->name = $name;
- return $this;
- }
- public function getListOrder(): ?int
- {
- return $this->listOrder;
- }
- public function setListOrder(int $listOrder): self
- {
- $this->listOrder = $listOrder;
- return $this;
- }
- public function getActive(): ?int
- {
- return $this->active;
- }
- public function setActive(int $active): self
- {
- $this->active = $active;
- return $this;
- }
- public function getIdioma(): ?string
- {
- return $this->idioma;
- }
- public function setIdioma(?string $idioma): self
- {
- $this->idioma = $idioma;
- 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->setCategory($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->getCategory() === $this) {
- $faq->setCategory(null);
- }
- }
- return $this;
- }
- public function isActive(): ?bool
- {
- return $this->active;
- }
- public function getSlug(): ?string
- {
- return $this->slug;
- }
- public function setSlug(?string $slug): self
- {
- $this->slug = $slug;
- return $this;
- }
- }