src/Entity/FreePageBlock.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FreePageBlockRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. /**
  8.  * @ORM\Entity(repositoryClass=FreePageBlockRepository::class)
  9.  * @ORM\HasLifecycleCallbacks()
  10.  * @Vich\Uploadable()
  11.  */
  12. class FreePageBlock
  13. {
  14.     const CAROUSEL_TYPE 3;
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      */
  24.     private $title;
  25.     /**
  26.      * @ORM\Column(type="text", nullable=true)
  27.      * @Assert\Regex(
  28.      *     pattern="/(<\s*svg\b|data:image\/svg\+xml)/i",
  29.      *     match=false,
  30.      *     message="Les balises ou contenus SVG sont interdits dans la description."
  31.      * )
  32.      */
  33.     private $text;
  34.     /**
  35.      * @ORM\OneToOne(targetEntity=Media::class, cascade={"persist", "remove"})
  36.      */
  37.     private $video;
  38.     /**
  39.      * @ORM\Column(type="datetime")
  40.      */
  41.     private $updatedAt;
  42.     /**
  43.      * @ORM\OneToOne(targetEntity=PageBlockCarousel::class, cascade={"persist", "remove"}, orphanRemoval=true)
  44.      */
  45.     private $carousel;
  46.     /**
  47.      * @ORM\Column(type="integer")
  48.      */
  49.     private $position;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity=FreePage::class, inversedBy="pageBlocks")
  52.      * @ORM\JoinColumn(nullable=false)
  53.      */
  54.     private $freePage;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=false)
  57.      */
  58.     private $backgroundColor;
  59.     /**
  60.      * @ORM\Column(type="string", length=255, nullable=false, options={"default" : "#ffffff"})
  61.      */
  62.     private $titleColor;
  63.     public function __construct()
  64.     {
  65.         $this->carousel = new PageBlockCarousel();
  66.         $this->updatedAt = new \Datetime();
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getText(): ?string
  73.     {
  74.         return $this->text;
  75.     }
  76.     public function setText(?string $text): self
  77.     {
  78.         $this->text $text;
  79.         return $this;
  80.     }
  81.     public function getTitle(): ?string
  82.     {
  83.         return $this->title;
  84.     }
  85.     public function setTitle(?string $title): self
  86.     {
  87.         $this->title $title;
  88.         return $this;
  89.     }
  90.     public function getVideo(): ?Media
  91.     {
  92.         return $this->video;
  93.     }
  94.     public function setVideo(?Media $video): self
  95.     {
  96.         $this->video $video;
  97.         return $this;
  98.     }
  99.     public function getUpdatedAt(): ?\DateTimeInterface
  100.     {
  101.         return $this->updatedAt;
  102.     }
  103.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  104.     {
  105.         $this->updatedAt $updatedAt;
  106.         return $this;
  107.     }
  108.     public function getCarousel(): ?PageBlockCarousel
  109.     {
  110.         return $this->carousel;
  111.     }
  112.     public function setCarousel(?PageBlockCarousel $carousel): self
  113.     {
  114.         $this->carousel $carousel;
  115.         return $this;
  116.     }
  117.     public function getPosition(): ?int
  118.     {
  119.         return $this->position;
  120.     }
  121.     public function setPosition(int $position): self
  122.     {
  123.         $this->position $position;
  124.         return $this;
  125.     }
  126.     public function getFreePage(): ?FreePage
  127.     {
  128.         return $this->freePage;
  129.     }
  130.     public function setFreePage(?FreePage $freePage): self
  131.     {
  132.         $this->freePage $freePage;
  133.         return $this;
  134.     }
  135.     public function getBackgroundColor(): string
  136.     {
  137.         return $this->backgroundColor;
  138.     }
  139.     public function setBackgroundColor(string $backgroundColor): self
  140.     {
  141.         $this->backgroundColor $backgroundColor;
  142.         return $this;
  143.     }
  144.     public function getTitleColor(): string
  145.     {
  146.         return $this->titleColor;
  147.     }
  148.     public function setTitleColor(string $titleColor): self
  149.     {
  150.         $this->titleColor $titleColor;
  151.         return $this;
  152.     }
  153. }