<?php
namespace App\Entity;
use App\Repository\SejourSessionPictureRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=SejourSessionPictureRepository::class)
* @Vich\Uploadable
*/
class SejourSessionPicture
{
const STATE_OPEN = "open";
const STATE_VALIDATED = "validated";
const STATE_REJECTED = "rejected";
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=SejourSession::class, inversedBy="sejourSessionPictures")
* @ORM\JoinColumn(nullable=false)
*/
private $sejourSession;
/**
* @ORM\Column(type="boolean")
*/
private $isValidated;
/**
* @ORM\Column(type="boolean")
*/
private $isFavorite;
/**
* @ORM\Column(type="datetime")
*/
private $creationDate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedDate;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $state;
/**
* @ORM\Column(type="string", length=512, nullable=true)
*/
private $filePath;
/**
* @Vich\UploadableField(mapping="frontend_image", fileNameProperty="filePath")
*
* @var File|null
*/
private $imgFile;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $validDate;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="medias")
*/
private $userValid;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="medias")
*/
private $userCreated;
public function __construct()
{
$this->creationDate = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getSejourSession(): ?SejourSession
{
return $this->sejourSession;
}
public function setSejourSession(?SejourSession $sejourSession): self
{
$this->sejourSession = $sejourSession;
return $this;
}
public function getIsValidated(): ?bool
{
return $this->isValidated;
}
public function setIsValidated(bool $isValidated): self
{
$this->isValidated = $isValidated;
return $this;
}
public function getIsFavorite(): ?bool
{
return $this->isFavorite;
}
public function setIsFavorite(bool $isFavorite): self
{
$this->isFavorite = $isFavorite;
return $this;
}
public function getCreationDate(): ?\DateTimeInterface
{
return $this->creationDate;
}
public function setCreationDate(\DateTimeInterface $creationDate): self
{
$this->creationDate = $creationDate;
return $this;
}
public function getState(): ?string
{
return $this->state;
}
public function setState(?string $state): self
{
$this->state = $state;
return $this;
}
public function setImgFile(?File $imageFile = null): self
{
$this->imgFile = $imageFile;
if ($imageFile) {
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedDate = new \DateTime('now');
}
return $this;
}
public function getImgFile(): ?File
{
return $this->imgFile;
}
public function getFilePath(): ?string
{
return $this->filePath;
}
public function setFilePath(?string $filePath): self
{
$this->filePath = $filePath;
return $this;
}
public function getUpdatedDate(): ?\DateTimeInterface
{
return $this->updatedDate;
}
public function setUpdatedDate(?\DateTimeInterface $updatedDate): self
{
$this->updatedDate = $updatedDate;
return $this;
}
public function getValidDate(): ?\DateTimeInterface
{
return $this->validDate;
}
public function setValidDate(?\DateTimeInterface $validDate): self
{
$this->validDate = $validDate;
return $this;
}
public function getUserValid(): ?User
{
return $this->userValid;
}
public function setUserValid(?User $userValid): self
{
$this->userValid = $userValid;
$this->validDate = new \DateTime('now');
return $this;
}
public function getUserCreated(): ?User
{
return $this->userCreated;
}
public function setUserCreated(?User $userCreated): self
{
$this->userCreated = $userCreated;
return $this;
}
}