<?php
namespace App\Entity;
use App\Repository\FreePageBlockRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=FreePageBlockRepository::class)
* @ORM\HasLifecycleCallbacks()
* @Vich\Uploadable()
*/
class FreePageBlock
{
const CAROUSEL_TYPE = 3;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $title;
/**
* @ORM\Column(type="text", nullable=true)
* @Assert\Regex(
* pattern="/(<\s*svg\b|data:image\/svg\+xml)/i",
* match=false,
* message="Les balises ou contenus SVG sont interdits dans la description."
* )
*/
private $text;
/**
* @ORM\OneToOne(targetEntity=Media::class, cascade={"persist", "remove"})
*/
private $video;
/**
* @ORM\Column(type="datetime")
*/
private $updatedAt;
/**
* @ORM\OneToOne(targetEntity=PageBlockCarousel::class, cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $carousel;
/**
* @ORM\Column(type="integer")
*/
private $position;
/**
* @ORM\ManyToOne(targetEntity=FreePage::class, inversedBy="pageBlocks")
* @ORM\JoinColumn(nullable=false)
*/
private $freePage;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private $backgroundColor;
/**
* @ORM\Column(type="string", length=255, nullable=false, options={"default" : "#ffffff"})
*/
private $titleColor;
public function __construct()
{
$this->carousel = new PageBlockCarousel();
$this->updatedAt = new \Datetime();
}
public function getId(): ?int
{
return $this->id;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getVideo(): ?Media
{
return $this->video;
}
public function setVideo(?Media $video): self
{
$this->video = $video;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getCarousel(): ?PageBlockCarousel
{
return $this->carousel;
}
public function setCarousel(?PageBlockCarousel $carousel): self
{
$this->carousel = $carousel;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(int $position): self
{
$this->position = $position;
return $this;
}
public function getFreePage(): ?FreePage
{
return $this->freePage;
}
public function setFreePage(?FreePage $freePage): self
{
$this->freePage = $freePage;
return $this;
}
public function getBackgroundColor(): string
{
return $this->backgroundColor;
}
public function setBackgroundColor(string $backgroundColor): self
{
$this->backgroundColor = $backgroundColor;
return $this;
}
public function getTitleColor(): string
{
return $this->titleColor;
}
public function setTitleColor(string $titleColor): self
{
$this->titleColor = $titleColor;
return $this;
}
}