<?php
namespace App\Entity;
use App\Repository\ActualiteOnpcRepository;
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;
/**
* @ORM\Entity(repositoryClass=ActualiteOnpcRepository::class)
* @ORM\Table(name="actualite_onpc")
* @Vich\Uploadable
*/
class ActualiteOnpc
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $titre;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $tag;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $photo;
/**
* @Vich\UploadableField(mapping="actualite_photo", fileNameProperty="photo")
* @var File|null
*/
private $photoFile;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isCarrousel;
/**
* @ORM\ManyToMany(targetEntity=Etablissement::class, inversedBy="actualitesOnpc")
*/
private $annonceurs; // n'est pas utilisée, affichage trop lors dans l'admin (car beaucoup d'établissements)
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $idsAnnonceur;
/**
* @ORM\Column(type="string", length=255)
*/
private $slug;
/**
* @ORM\ManyToOne(targetEntity=AuteurActuOnpc::class, inversedBy="actualites")
*/
private $auteur;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
public function __construct()
{
$this->annonceurs = new ArrayCollection();
$this->createdAt = new \DateTime();
}
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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getTag(): ?string
{
return $this->tag;
}
public function setTag(?string $tag): self
{
$this->tag = $tag;
return $this;
}
public function getPhoto(): ?string
{
return $this->photo;
}
public function setPhoto(?string $photo): self
{
$this->photo = $photo;
return $this;
}
public function getPhotoFile(): ?File
{
return $this->photoFile;
}
public function setPhotoFile(?File $photoFile = null): void
{
$this->photoFile = $photoFile;
if (null !== $photoFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTime();
}
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function isIsCarrousel(): ?bool
{
return $this->isCarrousel;
}
public function setIsCarrousel(?bool $isCarrousel): self
{
$this->isCarrousel = $isCarrousel;
return $this;
}
/**
* @return Collection<int, Etablissement>
*/
public function getAnnonceurs(): Collection
{
return $this->annonceurs;
}
public function addAnnonceur(Etablissement $annonceur): self
{
if (!$this->annonceurs->contains($annonceur)) {
$this->annonceurs[] = $annonceur;
}
return $this;
}
public function removeAnnonceur(Etablissement $annonceur): self
{
$this->annonceurs->removeElement($annonceur);
return $this;
}
public function getIdsAnnonceur(): ?string
{
return $this->idsAnnonceur;
}
public function setIdsAnnonceur(?string $idsAnnonceur): self
{
$this->idsAnnonceur = $idsAnnonceur;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getAuteur(): ?AuteurActuOnpc
{
return $this->auteur;
}
public function setAuteur(?AuteurActuOnpc $auteur): self
{
$this->auteur = $auteur;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
}