<?php
namespace App\Entity;
use App\Repository\FilmProjectSponsorRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity(repositoryClass: FilmProjectSponsorRepository::class)]
#[Vich\Uploadable]
class FilmProjectSponsor
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $logo = null;
#[Vich\UploadableField(mapping:'project_gallery_images', fileNameProperty:'logo')]
private $imageFile;
#[ORM\ManyToOne(inversedBy: 'filmProjectSponsors')]
private ?FilmProject $filmProject = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $logoUrl = null;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getFilmProject(): ?FilmProject
{
return $this->filmProject;
}
public function setFilmProject(?FilmProject $filmProject): self
{
$this->filmProject = $filmProject;
return $this;
}
public function getImageFile()
{
return $this->imageFile;
}
public function setImageFile(File $image = null)
{
$this->imageFile = $image;
if ($image) {
$this->logo = $image->getFileName();
}
}
public function getImageUrl(): ?string
{
$url = '';
if ($this->logo) {
$url = '/uploads/projects/' . $this->logo;
}
return $url;
}
public function getLogoUrl(): ?string
{
return $this->logoUrl;
}
public function setLogoUrl(?string $logoUrl): self
{
$this->logoUrl = $logoUrl;
return $this;
}
public function __toString()
{
return $this->name;
}
}