<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\SliderRepository;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\File\File;
/**
* @ORM\Entity(repositoryClass=SliderRepository::class)
* @Vich\Uploadable
*/
class Slider
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $photo;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lien;
/**
* @ORM\Column(type="boolean")
*/
private $isPharmacie = false;
/**
* @ORM\Column(type="boolean")
*/
private $isGrossiste = false;
/**
* @ORM\Column(type="boolean")
*/
private $isPrescripteur = false;
/**
* @ORM\ManyToOne(targetEntity=Laboratoire::class, inversedBy="sliders")
*/
private $laboratoire;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @Vich\UploadableField(mapping="slider_image", fileNameProperty="photo")
* @var File|null
* @Assert\Image(
* mimeTypes = {"image/jpeg", "image/gif", "image/png", "image/jpg"},
* )
*/
private $imageFile;
public function getId(): ?int
{
return $this->id;
}
public function getPhoto(): ?string
{
return $this->photo;
}
public function setPhoto(?string $photo): self
{
$this->photo = $photo;
return $this;
}
public function getLien(): ?string
{
return $this->lien;
}
public function setLien(?string $lien): self
{
$this->lien = $lien;
return $this;
}
public function getIsPharmacie(): ?bool
{
return $this->isPharmacie;
}
public function setIsPharmacie(bool $isPharmacie): self
{
$this->isPharmacie = $isPharmacie;
return $this;
}
public function getIsGrossiste(): ?bool
{
return $this->isGrossiste;
}
public function setIsGrossiste(bool $isGrossiste): self
{
$this->isGrossiste = $isGrossiste;
return $this;
}
public function getIsPrescripteur(): ?bool
{
return $this->isPrescripteur;
}
public function setIsPrescripteur(bool $isPrescripteur): self
{
$this->isPrescripteur = $isPrescripteur;
return $this;
}
public function getLaboratoire(): ?Laboratoire
{
return $this->laboratoire;
}
public function setLaboratoire(?Laboratoire $laboratoire): self
{
$this->laboratoire = $laboratoire;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
//pour l'upload image
public function setImageFile(?File $imageFile = null):Slider
{
$this->imageFile = $imageFile;
if ($imageFile instanceof UploadedFile) {
$this->updatedAt = new \DateTime('now');
}
return $this;
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
}