<?php
namespace App\Entity;
use App\Repository\ChatbotSectionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ChatbotSectionRepository::class)]
class ChatbotSection
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\ManyToOne(inversedBy: 'chatbotSections')]
#[ORM\JoinColumn(nullable: false)]
private ?User $createdBy = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $deletedAt = null;
#[ORM\OneToMany(mappedBy: 'ChatbotSection', targetEntity: ChatbotPrompt::class, orphanRemoval: true)]
private Collection $chatbotPrompts;
#[ORM\OneToMany(mappedBy: 'ChatbotSection', targetEntity: ChatbotSectionDepartment::class, orphanRemoval: true)]
private Collection $chatbotSectionDepartments;
public function __construct()
{
$this->chatbotPrompts = new ArrayCollection();
$this->chatbotSectionDepartments = new ArrayCollection();
}
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 getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getDeletedAt(): ?\DateTimeImmutable
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeImmutable $deletedAt): self
{
$this->deletedAt = $deletedAt;
return $this;
}
/**
* @return Collection<int, ChatbotPrompt>
*/
public function getChatbotPrompts(): Collection
{
return $this->chatbotPrompts;
}
public function addChatbotPrompt(ChatbotPrompt $chatbotPrompt): self
{
if (!$this->chatbotPrompts->contains($chatbotPrompt)) {
$this->chatbotPrompts->add($chatbotPrompt);
$chatbotPrompt->setChatbotSection($this);
}
return $this;
}
public function removeChatbotPrompt(ChatbotPrompt $chatbotPrompt): self
{
if ($this->chatbotPrompts->removeElement($chatbotPrompt)) {
// set the owning side to null (unless already changed)
if ($chatbotPrompt->getChatbotSection() === $this) {
$chatbotPrompt->setChatbotSection(null);
}
}
return $this;
}
/**
* @return Collection<int, ChatbotSectionDepartment>
*/
public function getChatbotSectionDepartments(): Collection
{
return $this->chatbotSectionDepartments;
}
public function addChatbotSectionDepartment(ChatbotSectionDepartment $chatbotSectionDepartment): self
{
if (!$this->chatbotSectionDepartments->contains($chatbotSectionDepartment)) {
$this->chatbotSectionDepartments->add($chatbotSectionDepartment);
$chatbotSectionDepartment->setChatbotSection($this);
}
return $this;
}
public function removeChatbotSectionDepartment(ChatbotSectionDepartment $chatbotSectionDepartment): self
{
if ($this->chatbotSectionDepartments->removeElement($chatbotSectionDepartment)) {
// set the owning side to null (unless already changed)
if ($chatbotSectionDepartment->getChatbotSection() === $this) {
$chatbotSectionDepartment->setChatbotSection(null);
}
}
return $this;
}
}