<?php
namespace App\Entity;
use App\Repository\PolitiqueDepartementaleRepository;
use DateTime;
use DateTimeInterface;
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: PolitiqueDepartementaleRepository::class)]
class PolitiqueDepartementale implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = 0;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $titre = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $pictogramme = null;
/**
* @Vich\UploadableField(mapping="url_icon_images", fileNameProperty="pictogramme")
*/
private ?File $urlIconFile = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $alias_url = null;
#[ORM\Column(type: 'boolean')]
private bool $sommaire_affiche;
#[ORM\Column(type: 'datetime', nullable: true)]
private mixed $date_update;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $content = null;
#[ORM\ManyToMany(targetEntity: Service::class, inversedBy: 'politiqueDepartementales')]
private mixed $services;
#[ORM\ManyToMany(targetEntity: Document::class, inversedBy: 'politiqueDepartementales')]
private mixed $documents;
#[ORM\ManyToMany(targetEntity: Contact::class, inversedBy: 'politiqueDepartementales')]
private mixed $contacts;
#[ORM\ManyToOne(targetEntity: RssArticle::class, inversedBy: 'politiqueDepartementales')]
private mixed $nordinfo_rss;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $ordre;
#[ORM\ManyToOne(targetEntity: Statut::class, inversedBy: 'politiqueDepartementales')]
private mixed $statut;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $chapo = null;
#[ORM\ManyToMany(targetEntity: Epingle::class, mappedBy: 'visible_politiques')]
private mixed $epingles;
public function __construct()
{
$this->services = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->contacts = new ArrayCollection();
$this->epingles = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDateUpdate(): ?DateTimeInterface
{
return $this->date_update;
}
public function setDateUpdate(?DateTimeInterface $date_update): self
{
$this->date_update = $date_update;
return $this;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(?string $titre): self
{
$this->titre = $titre;
return $this;
}
public function getPictogramme(): ?string
{
return $this->pictogramme;
}
public function setPictogramme(?string $pictogramme): self
{
$this->pictogramme = $pictogramme;
return $this;
}
public function setUrlIconFile(?File $urlIconFile = null): void
{
$this->urlIconFile = $urlIconFile;
if ($urlIconFile) {
$this->date_update = new DateTime('now');
}
}
public function getUrlIconFile(): ?File
{
return $this->urlIconFile;
}
public function getAliasUrl(): ?string
{
return $this->alias_url;
}
public function setAliasUrl(?string $alias_url): self
{
$this->alias_url = $alias_url;
return $this;
}
public function getSommaireAffiche(): ?bool
{
return $this->sommaire_affiche;
}
public function setSommaireAffiche(bool $sommaire_affiche): self
{
$this->sommaire_affiche = $sommaire_affiche;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
/**
* @return Collection|Service[]
*/
public function getServices(): Collection
{
return $this->services;
}
public function addService(Service $service): self
{
if (!$this->services->contains($service)) {
$this->services[] = $service;
}
return $this;
}
public function removeService(Service $service): self
{
$this->services->removeElement($service);
return $this;
}
/**
* @return Collection|Document[]
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
}
return $this;
}
public function removeDocument(Document $document): self
{
$this->documents->removeElement($document);
return $this;
}
/**
* @return Collection|Contact[]
*/
public function getContacts(): Collection
{
return $this->contacts;
}
public function addContact(Contact $contact): self
{
if (!$this->contacts->contains($contact)) {
$this->contacts[] = $contact;
}
return $this;
}
public function removeContact(Contact $contact): self
{
$this->contacts->removeElement($contact);
return $this;
}
public function getNordinfoRss(): ?RssArticle
{
return $this->nordinfo_rss;
}
public function setNordinfoRss(?RssArticle $nordinfo_rss): self
{
$this->nordinfo_rss = $nordinfo_rss;
return $this;
}
public function getOrdre(): ?int
{
return $this->ordre;
}
public function setOrdre(?int $ordre): self
{
$this->ordre = $ordre;
return $this;
}
public function __toString(): string
{
return (string)$this->titre;
}
public function getStatut(): ?Statut
{
return $this->statut;
}
public function setStatut(?Statut $statut): self
{
$this->statut = $statut;
return $this;
}
public function getChapo(): ?string
{
return $this->chapo;
}
public function setChapo(?string $chapo): self
{
$this->chapo = $chapo;
return $this;
}
/**
* @return Collection|Epingle[]
*/
public function getEpingles(): Collection
{
return $this->epingles;
}
public function addEpingle(Epingle $epingle): self
{
if (!$this->epingles->contains($epingle)) {
$this->epingles[] = $epingle;
$epingle->addVisiblePolitique($this);
}
return $this;
}
public function removeEpingle(Epingle $epingle): self
{
if ($this->epingles->removeElement($epingle)) {
$epingle->removeVisiblePolitique($this);
}
return $this;
}
}