<?php
namespace App\Entity;
use App\Repository\PhotoRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use DateTimeInterface;
#[ORM\Entity(repositoryClass: PhotoRepository::class)]
#[Vich\Uploadable]
class Photo
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer")]
private $id;
#[ORM\Column(type: "text", nullable: true)]
private $description;
#[ORM\Column(type: "string", length: 255)]
private $genre;
#[ORM\Column(type: "string", length: 255, nullable: true)]
private $title;
#[ORM\Column(type: "string", length: 255, nullable: true)]
private $path;
#[ORM\Column(type: "integer", length: 7, nullable: true)]
private $price;
#[Vich\UploadableField(mapping: "photos", fileNameProperty: "path")]
private ?File $imageFile = null;
#[ORM\Column(type: "datetime", nullable: true)]
private $updatedAt;
#[ORM\Column(type: "datetime", nullable: true)]
private $createdAt;
public function getId(): ?int
{
return $this->id;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getGenre(): ?string
{
return $this->genre;
}
public function setGenre(string $genre): self
{
$this->genre = $genre;
return $this;
}
public function getPath(): ?string
{
return $this->path;
}
public function setPath(?string $path): self
{
$this->path = $path;
return $this;
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageFile(?File $imageFile = null): self
{
$this->imageFile = $imageFile;
if ($imageFile !== null) {
$this->updatedAt = new \DateTimeImmutable();
}
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getPrice(): ?int
{
return $this->price;
}
public function setPrice(?int $price): self
{
$this->price = $price;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getCreatedAt(): ?DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
}