src/Entity/Dialogue.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DialogueRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. #[ORM\Entity(repositoryClassDialogueRepository::class)]
  10. class Dialogue
  11. {
  12.     const STATUS_PUBLIC "public";
  13.     const STATUS_NOT_PUBLIC "not public";
  14.     const STATUS_EXTRA "extra";
  15.     
  16.     static public function getTypeOptions()
  17.     {
  18.         return [
  19.             'Niepubliczny' => self::STATUS_NOT_PUBLIC,
  20.             'Publiczny' => self::STATUS_PUBLIC,
  21.             'Ekstra' => self::STATUS_EXTRA,
  22.         ];
  23.     }
  24.     
  25.     #[ORM\Id]
  26.     #[ORM\GeneratedValue]
  27.     #[ORM\Column]
  28.     private ?int $id null;
  29.     #[ORM\Column(length255)]
  30.     private ?string $title null;
  31.     #[ORM\Column]
  32.     #[Gedmo\SortablePosition]
  33.     private ?int $position null;
  34.     #[ORM\OneToMany(mappedBy'dialogue'targetEntityBlock::class, orphanRemovaltrue)]
  35.     private Collection $blocks;
  36.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  37.     private ?string $content null;
  38.     #[ORM\Column(length255nullabletrue)]
  39.     private ?string $image null;
  40.     #[ORM\Column(length255nullabletrue)]
  41.     private ?string $color null;
  42.     #[ORM\Column(length255nullabletrue)]
  43.     private ?string $backgroundColor null;
  44.     #[ORM\Column(length255)]
  45.     private ?string $status null;
  46.     public function __construct()
  47.     {
  48.         $this->blocks = new ArrayCollection();
  49.     }
  50.     public function __toString()
  51.     {
  52.         return $this->title;        
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getTitle(): ?string
  59.     {
  60.         return $this->title;
  61.     }
  62.     public function setTitle(string $title): self
  63.     {
  64.         $this->title $title;
  65.         return $this;
  66.     }
  67.     public function getPosition(): ?int
  68.     {
  69.         return $this->position;
  70.     }
  71.     public function setPosition(int $position): self
  72.     {
  73.         $this->position $position;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return Collection<int, Block>
  78.      */
  79.     public function getBlocks(): Collection
  80.     {
  81.         return $this->blocks;
  82.     }
  83.     public function addBlock(Block $block): self
  84.     {
  85.         if (!$this->blocks->contains($block)) {
  86.             $this->blocks->add($block);
  87.             $block->setDialogue($this);
  88.         }
  89.         return $this;
  90.     }
  91.     public function removeBlock(Block $block): self
  92.     {
  93.         if ($this->blocks->removeElement($block)) {
  94.             // set the owning side to null (unless already changed)
  95.             if ($block->getDialogue() === $this) {
  96.                 $block->setDialogue(null);
  97.             }
  98.         }
  99.         return $this;
  100.     }
  101.     public function getContent(): ?string
  102.     {
  103.         return $this->content;
  104.     }
  105.     public function setContent(?string $content): self
  106.     {
  107.         $this->content $content;
  108.         return $this;
  109.     }
  110.     public function getImage(): ?string
  111.     {
  112.         return ($this->image $this->image '');
  113.     }
  114.     public function setImage(?string $image): self
  115.     {
  116.         $this->image $image;
  117.         return $this;
  118.     }
  119.     public function getColor(): ?string
  120.     {
  121.         return $this->color;
  122.     }
  123.     public function setColor(?string $color): self
  124.     {
  125.         $this->color $color;
  126.         return $this;
  127.     }
  128.     public function getBackgroundColor(): ?string
  129.     {
  130.         return $this->backgroundColor;
  131.     }
  132.     public function setBackgroundColor(?string $backgroundColor): self
  133.     {
  134.         $this->backgroundColor $backgroundColor;
  135.         return $this;
  136.     }
  137.     public function getStatus(): ?string
  138.     {
  139.         return $this->status;
  140.     }
  141.     public function setStatus(string $status): self
  142.     {
  143.         $this->status $status;
  144.         return $this;
  145.     }
  146. }