<?php
namespace App\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\App\SliderRepository")
*
* @Vich\Uploadable
*/
class Slider
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
protected int $id;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
protected string $sliderName;
/**
* @ORM\Column(type="string", length=255)
*/
protected string $title;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected ?\DateTimeInterface $startDate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected ?\DateTimeInterface $endDate;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected ?string $text;
/**
* @Vich\UploadableField(mapping="consumption_slider_image", fileNameProperty="image")
* @Assert\File(
* mimeTypes = {"image/jpg", "image/jpeg", "image/png"},
* mimeTypesMessage = "Vous ne pouvez insérer que des images au format jpg/png"
* )
*
* @var File
*/
protected $imageFile;
/**
* @ORM\Column (type="integer", nullable=true)
* @Assert\GreaterThanOrEqual (0)
*/
protected ?int $priority;
/**
* @ORM\Column (type="string", length=255, nullable=true)
*/
protected ?string $linkUrl;
/**
* @ORM\Column(type="text", length=10, nullable=true)
* @Assert\Choice ({"_blank", "_self"})
*/
protected ?string $linkTarget;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $image;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $linkDescription;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?DateTime $updatedAt;
public function getId(): ?int
{
return $this->id;
}
/**
* @return Slider
*/
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getSliderName(): string
{
return $this->sliderName;
}
public function setSliderName(string $sliderName): void
{
$this->sliderName = $sliderName;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getStartDate(): ?\DateTimeInterface
{
return $this->startDate;
}
public function setStartDate(?\DateTimeInterface $startDate): self
{
$this->startDate = $startDate;
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->endDate;
}
public function setEndDate(?\DateTimeInterface $endDate): self
{
$this->endDate = $endDate;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
/**
* @return Dashboard
* @throws \Exception
*
*/
public function setImageFile(?File $imageFile): self
{
$this->imageFile = $imageFile;
if ($imageFile) {
$this->updatedAt = new \DateTime('now');
}
return $this;
}
public function getPriority(): ?int
{
return $this->priority;
}
public function setPriority(?int $priority): self
{
$this->priority = $priority;
return $this;
}
public function getLinkUrl(): ?string
{
return $this->linkUrl;
}
public function setLinkUrl($linkUrl): self
{
$this->linkUrl = $linkUrl;
return $this;
}
public function getLinkTarget(): ?string
{
return $this->linkTarget;
}
public function setLinkTarget($linkTarget): self
{
$this->linkTarget = $linkTarget;
return $this;
}
public function getLinkDescription(): ?string
{
return $this->linkDescription;
}
public function setLinkDescription(?string $linkDescription): self
{
$this->linkDescription = $linkDescription;
return $this;
}
}