src/Entity/PageSection.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Gedmo\Timestampable\Traits\TimestampableEntity;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\PageSectionRepository")
  10.  */
  11. class PageSection
  12. {
  13.     use TimestampableEntity;
  14.     /**
  15.      * @ORM\Id()
  16.      * @ORM\GeneratedValue()
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @Groups({"data"})
  22.      * @ORM\Column(type="string", length=255)
  23.      * @Assert\NotBlank()
  24.      */
  25.     private $title;
  26.     /**
  27.      * @Groups({"data"})
  28.      * @ORM\Column(type="text")
  29.      * @Assert\NotBlank()
  30.      */
  31.     private $content;
  32.     /**
  33.      * @Groups({"data"})
  34.      * @ORM\Column(type="integer")
  35.      * @Gedmo\SortablePosition()
  36.      */
  37.     private $position;
  38.     /**
  39.      * Page.
  40.      *
  41.      * @Gedmo\SortableGroup
  42.      * @ORM\ManyToOne(targetEntity="App\Entity\Page", inversedBy="pageSections")
  43.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  44.      * @Assert\NotNull()
  45.      */
  46.     private $page;
  47.     public function __toString()
  48.     {
  49.         return $this->title.$this->content;
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getTitle(): ?string
  56.     {
  57.         return $this->title;
  58.     }
  59.     public function setTitle(string $title): self
  60.     {
  61.         $this->title $title;
  62.         return $this;
  63.     }
  64.     public function getContent(): ?string
  65.     {
  66.         return $this->content;
  67.     }
  68.     public function setContent(string $content): self
  69.     {
  70.         $this->content $content;
  71.         return $this;
  72.     }
  73.     public function getPosition(): ?int
  74.     {
  75.         return $this->position;
  76.     }
  77.     public function setPosition(int $position): self
  78.     {
  79.         $this->position $position;
  80.         return $this;
  81.     }
  82.     public function getPage(): ?Page
  83.     {
  84.         return $this->page;
  85.     }
  86.     public function setPage(?Page $page): self
  87.     {
  88.         $this->page $page;
  89.         return $this;
  90.     }
  91. }