<?php
namespace App\Entity;
use App\Repository\ServiceFocusPubRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @Vich\Uploadable
*/
#[ORM\Entity(repositoryClass: ServiceFocusPubRepository::class)]
class ServiceFocusPub implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $titre= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $image_name= null;
/**
* @Vich\UploadableField(mapping="images", fileNameProperty="image_name")
*/
private ?\Symfony\Component\HttpFoundation\File\File $image = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $image_url= null;
#[ORM\ManyToMany(targetEntity: ServiceGrandProfil::class, inversedBy: 'serviceFocusPubs')]
private mixed $grandprofils;
#[ORM\ManyToMany(targetEntity: ServiceSousProfil::class, inversedBy: 'serviceFocusPubs')]
private mixed $sousprofils;
#[ORM\ManyToMany(targetEntity: ServiceTheme::class, inversedBy: 'serviceFocusPubs')]
private mixed $themes;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $description= null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $url= null;
#[ORM\Column(type: 'datetime', nullable: true)]
private mixed $date_update;
public function __construct()
{
$this->grandprofils = new ArrayCollection();
$this->sousprofils = new ArrayCollection();
$this->themes = new ArrayCollection();
}
public function setImage(File $file = null): void
{
$this->image = $file;
if ($file) {
$this->date_update = new \DateTime;
}
}
public function getImage(): mixed
{
return $this->image;
}
public function getId(): ?int
{
return $this->id;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(?string $titre): self
{
$this->titre = $titre;
return $this;
}
public function getImageName(): ?string
{
return $this->image_name;
}
public function setImageName(?string $image_name): self
{
$this->image_name = $image_name;
return $this;
}
public function getImageUrl(): ?string
{
return $this->image_url;
}
public function setImageUrl(?string $image_url): self
{
$this->image_url = $image_url;
return $this;
}
/**
* @return Collection|ServiceGrandProfil[]
*/
public function getGrandprofils(): Collection
{
return $this->grandprofils;
}
public function addGrandprofil(ServiceGrandProfil $grandprofil): self
{
if (!$this->grandprofils->contains($grandprofil)) {
$this->grandprofils[] = $grandprofil;
}
return $this;
}
public function removeGrandprofil(ServiceGrandProfil $grandprofil): self
{
$this->grandprofils->removeElement($grandprofil);
return $this;
}
/**
* @return Collection|ServiceSousProfil[]
*/
public function getSousprofils(): Collection
{
return $this->sousprofils;
}
public function addSousprofil(ServiceSousProfil $sousprofil): self
{
if (!$this->sousprofils->contains($sousprofil)) {
$this->sousprofils[] = $sousprofil;
}
return $this;
}
public function removeSousprofil(ServiceSousProfil $sousprofil): self
{
$this->sousprofils->removeElement($sousprofil);
return $this;
}
/**
* @return Collection|ServiceTheme[]
*/
public function getThemes(): Collection
{
return $this->themes;
}
public function addTheme(ServiceTheme $theme): self
{
if (!$this->themes->contains($theme)) {
$this->themes[] = $theme;
}
return $this;
}
public function removeTheme(ServiceTheme $theme): self
{
$this->themes->removeElement($theme);
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getDateUpdate(): ?\DateTimeInterface
{
return $this->date_update;
}
public function setDateUpdate(?\DateTimeInterface $date_update): self
{
$this->date_update = $date_update;
return $this;
}
public function __toString(): string
{
return (string) $this->titre;
}
}