src/Entity/Gos/ChatbotSection.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Repository\Gos\ChatbotSectionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ChatbotSectionRepository::class)
  9.  */
  10. class ChatbotSection
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $position;
  22.     /**
  23.      * @ORM\Column(type="boolean", options={"default": 0})
  24.      */
  25.     private $isMain false;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $title;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=ChatbotDialog::class, inversedBy="childrenSections")
  32.      */
  33.     private $parentDialog;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=ChatbotDialog::class, mappedBy="parentSection")
  36.      */
  37.     private $chatbotDialogs;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=ChatbotDialog::class)
  40.      */
  41.     private $backToDialog;
  42.     public function __construct()
  43.     {
  44.         $this->chatbotDialogs = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getPosition(): ?int
  51.     {
  52.         return $this->position;
  53.     }
  54.     public function setPosition(int $position): self
  55.     {
  56.         $this->position $position;
  57.         return $this;
  58.     }
  59.     public function getIsMain(): ?bool
  60.     {
  61.         return $this->isMain;
  62.     }
  63.     public function setIsMain(bool $isMain): self
  64.     {
  65.         $this->isMain $isMain;
  66.         return $this;
  67.     }
  68.     public function getTitle(): ?string
  69.     {
  70.         return $this->title;
  71.     }
  72.     public function setTitle(string $title): self
  73.     {
  74.         $this->title $title;
  75.         return $this;
  76.     }
  77.     public function getParentDialog(): ?ChatbotDialog
  78.     {
  79.         return $this->parentDialog;
  80.     }
  81.     public function setParentDialog(?ChatbotDialog $parentDialog): self
  82.     {
  83.         $this->parentDialog $parentDialog;
  84.         return $this;
  85.     }
  86.     public function getChatbotDialog(): ?ChatbotDialog
  87.     {
  88.         if ($this->getChatbotDialogs()->isEmpty() === false) {
  89.             return $this->getChatbotDialogs()->first();
  90.         }
  91.         return null;
  92.     }
  93.     /**
  94.      * @return Collection|ChatbotDialog[]
  95.      */
  96.     public function getChatbotDialogs(): Collection
  97.     {
  98.         return $this->chatbotDialogs;
  99.     }
  100.     public function addChatboxDialog(ChatbotDialog $chatboxDialog): self
  101.     {
  102.         if (!$this->chatbotDialogs->contains($chatboxDialog)) {
  103.             $this->chatbotDialogs[] = $chatboxDialog;
  104.             $chatboxDialog->setParentSection($this);
  105.         }
  106.         return $this;
  107.     }
  108.     public function removeChatboxDialog(ChatbotDialog $chatboxDialog): self
  109.     {
  110.         if ($this->chatbotDialogs->contains($chatboxDialog)) {
  111.             $this->chatbotDialogs->removeElement($chatboxDialog);
  112.             // set the owning side to null (unless already changed)
  113.             if ($chatboxDialog->getParentSection() === $this) {
  114.                 $chatboxDialog->setParentSection(null);
  115.             }
  116.         }
  117.         return $this;
  118.     }
  119.     public function findParentSection(): ?ChatbotSection
  120.     {
  121.         if ($this->getParentDialog() !== null) {
  122.             return $this->getParentDialog()->findParentSection();
  123.         }
  124.         return null;
  125.     }
  126.     public function getBackToDialog(): ?ChatbotDialog
  127.     {
  128.         return $this->backToDialog;
  129.     }
  130.     public function setBackToDialog(?ChatbotDialog $backToDialog): self
  131.     {
  132.         $this->backToDialog $backToDialog;
  133.         return $this;
  134.     }
  135. }