<?php
namespace App\Entity;
use App\Repository\CatImageRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CatImageRepository::class)]
class CatImage
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $title;
#[ORM\Column(type: 'string', length: 255)]
private $file;
#[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'images')]
#[ORM\JoinColumn(nullable: false)]
private $category;
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getFile(): ?string
{
return $this->file;
}
public function setFile(string $file): self
{
$this->file = $file;
return $this;
}
public function getCategory(): ?Category
{
return $this->category;
}
public function setCategory(?Category $category): self
{
$this->category = $category;
return $this;
}
public function getUploadPath(): ?string
{
return 'public/images/GestionImage/' . $this->category->getTitle();
}
public function getUploadPathFiles(): ?string
{
return 'public/images/GestionImage/Files/' . $this->category->getTitle();
}
}