src/Entity/Gos/FaqSection.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\Gos\FaqSectionRepository")
  8.  */
  9. class FaqSection
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $name;
  21.     /**
  22.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\FaqItem", mappedBy="faqSection", cascade={"persist"})
  23.      */
  24.     private $faqItems;
  25.     public function __construct()
  26.     {
  27.         $this->faqItems = new ArrayCollection();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getName(): ?string
  34.     {
  35.         return $this->name;
  36.     }
  37.     public function setName(string $name): self
  38.     {
  39.         $this->name $name;
  40.         return $this;
  41.     }
  42.     /**
  43.      * @return Collection|FaqItem[]
  44.      */
  45.     public function getFaqItems(): Collection
  46.     {
  47.         return $this->faqItems;
  48.     }
  49.     public function addFaqItem(FaqItem $faqItem): self
  50.     {
  51.         if (!$this->faqItems->contains($faqItem)) {
  52.             $this->faqItems[] = $faqItem;
  53.             $faqItem->setFaqSection($this);
  54.         }
  55.         return $this;
  56.     }
  57.     public function removeFaqItem(FaqItem $faqItem): self
  58.     {
  59.         if ($this->faqItems->contains($faqItem)) {
  60.             $this->faqItems->removeElement($faqItem);
  61.             // set the owning side to null (unless already changed)
  62.             if ($faqItem->getFaqSection() === $this) {
  63.                 $faqItem->setFaqSection(null);
  64.             }
  65.         }
  66.         return $this;
  67.     }
  68. }