src/Entity/Block.php line 13
<?phpnamespace App\Entity;use App\Repository\BlockRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;#[ORM\Entity(repositoryClass: BlockRepository::class)]class Block{const TYPE_HTML = "html";const TYPE_QUESTION = "question";const TYPE_AUDIO = "audio";const TYPE_AUDIO_2 = "audio2";const TYPE_VIDEO = "video";const TYPE_LINK = "link";const TYPE_IMAGE = "image";const TYPE_TEXT = "text";static public function getTypeOptions(){return ['HTML' => self::TYPE_HTML,'Question' => self::TYPE_QUESTION,'Audio' => self::TYPE_AUDIO,'Audio2' => self::TYPE_AUDIO_2,'Video' => self::TYPE_VIDEO,'Link' => self::TYPE_LINK,'Image' => self::TYPE_IMAGE,'Text' => self::TYPE_TEXT];}#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $type = null;#[ORM\Column]#[Gedmo\SortablePosition]private ?int $position = null;#[ORM\Column(length: 255)]private ?string $title = null;#[ORM\Column(type: Types::TEXT)]private ?string $content1 = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $content2 = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $content3 = null;#[ORM\ManyToOne(inversedBy: 'blocks')]#[ORM\JoinColumn(nullable: false)]#[Gedmo\SortableGroup]private ?Dialogue $dialogue = null;#[ORM\OneToMany(mappedBy: 'block', targetEntity: Question::class, orphanRemoval: true, cascade: ['persist'])]private Collection $questions;#[ORM\Column(nullable: true)]private ?bool $switch = null;#[ORM\Column(length: 255, nullable: true)]private ?string $parameter = null;public function __toString(){return $this->type . " - " . $this->title;}public function __construct(){$this->questions = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getType(): ?string{return $this->type;}public function setType(string $type): self{$this->type = $type;return $this;}public function getPosition(): ?int{return $this->position;}public function setPosition(int $position): self{$this->position = $position;return $this;}public function getTitle(): ?string{return $this->title;}public function setTitle(string $title): self{$this->title = $title;return $this;}public function getContent1(): string{return ($this->content1 ? $this->content1 : '');}public function setContent1(string $content1): self{$this->content1 = $content1;return $this;}public function getContent2(): string{return ($this->content2 ? $this->content2 : '');}public function setContent2(?string $content2): self{$this->content2 = $content2;return $this;}public function getContent3(): string{return ($this->content3 ? $this->content3 : '');}public function setContent3(?string $content3): self{$this->content3 = $content3;return $this;}public function getDialogue(): ?Dialogue{return $this->dialogue;}public function setDialogue(?Dialogue $dialogue): self{$this->dialogue = $dialogue;return $this;}/*** @return Collection<int, Question>*/public function getQuestions(): Collection{return $this->questions;}public function addQuestion(Question $question): self{if (!$this->questions->contains($question)) {$this->questions->add($question);$question->setBlock($this);}return $this;}public function removeQuestion(Question $question): self{if ($this->questions->removeElement($question)) {// set the owning side to null (unless already changed)if ($question->getBlock() === $this) {$question->setBlock(null);}}return $this;}public function isSwitch(): ?bool{return $this->switch;}public function setSwitch(?bool $switch): self{$this->switch = $switch;return $this;}public function getParameter(): ?string{return $this->parameter;}public function setParameter(?string $parameter): self{$this->parameter = $parameter;return $this;}public function clone(): Block{$new = new Block();$new->setContent1($this->content1);$new->setContent2($this->content2);$new->setContent3($this->content3);$new->setPosition(-1);$new->setParameter($this->parameter);$new->setSwitch($this->switch);$new->setTitle($this->title);$new->setType($this->type);return $new;}}