<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Controller\PlanificationController;
use App\Repository\EditionPlanificationRepository;
use App\Service\PlanificationService;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\EditionPlanificationRepository")
*/
class EditionPlanification
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Selection", inversedBy="planifications")
* @ORM\JoinColumn(name="selection_id", referencedColumnName="id", nullable=false)
*/
private $selection;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\EditionModele", inversedBy="planifications")
* @ORM\JoinColumn(name="modele_id", referencedColumnName="id", nullable=false)
*/
private $modele;
/**
* @ORM\Column(type="string", length=50, nullable=true, options={"comment":"Type d'export (`PDF_UNIQUE`, `FICHE_PDF`, `FICHE_JPG`, `PAGE_JPG`)"})
*/
private $exportMode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $frequence;
/**
* @ORM\Column(type="json", nullable=true, options={"comment":"jour et heure (ou seulement heure)"})
*/
private $time;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $texteVolee;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $sendByEmail;
/**
* @ORM\Column(type="string", length=5, nullable=true, options={"comment":"Type de réception (`EMAIL`, `FTP` ou `LIEN`)"})
*/
private $receptionType;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $ftpData;
/**
* @ORM\Column(type="datetime", nullable=true, options={"comment":"Prochaine date de traitement de la tâche"})
*/
private $dueDate;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $enableNotifications = true;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lang = 'fr';
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="editionPlanifications")
*/
private $owner;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="editionPlanifications")
*/
private $entity;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $state;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private $disabled;
/**
* @ORM\Column(type="string", length=255, nullable=true, options={"comment":"Lien permanent pour le téléchargement du fichier"})
*/
private $permanentFilename;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": false})
*/
private $modeGuideAccueil;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Selection", inversedBy="guidesAccueilPlanifications", cascade={"persist"})
* @ORM\JoinColumn(name="selection_guide_accueil_id", referencedColumnName="id", nullable=true )
*/
private $selectionGuideAccueil;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $rayonGuideAccueil;
/**
* @ORM\Column(type="string", nullable=true, options={"comment":"FIltre (`RAYON` ou `VILLE`)"})
*/
private $filterGuideAccueil;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\EditionsPlanner", mappedBy="planification", cascade={"persist","remove"})
*/
private $planners;
public function __construct()
{
$this->planners = new ArrayCollection();
}
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 getSelection(): ?Selection
{
return $this->selection;
}
public function setSelection(?Selection $selection): self
{
$this->selection = $selection;
return $this;
}
public function getModele(): ?EditionModele
{
return $this->modele;
}
public function setModele(?EditionModele $modele): self
{
$this->modele = $modele;
return $this;
}
public function getExportMode(): ?string
{
return $this->exportMode;
}
public function setExportMode(?string $exportMode): self
{
// Ajout d'un log pour vérifier si on rentre ici
error_log(sprintf('setExportMode called with: %s', $exportMode));
$this->exportMode = $exportMode;
return $this;
}
public function getFrequence(): ?string
{
return $this->frequence;
}
public function setFrequence(?string $frequence): self
{
$this->frequence = $frequence;
return $this;
}
public function getTime(): ?array
{
return $this->time;
}
public function setTime(?array $time): self
{
$this->time = $time;
return $this;
}
public function getTexteVolee(): ?string
{
return $this->texteVolee;
}
public function setTexteVolee(?string $texteVolee): self
{
$this->texteVolee = $texteVolee;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getSendByEmail(): ?bool
{
return $this->sendByEmail;
}
public function setSendByEmail(?bool $sendByEmail): self
{
$this->sendByEmail = $sendByEmail;
return $this;
}
public function getReceptionType(): ?string
{
return $this->receptionType;
}
public function setReceptionType(?string $receptionType): self
{
$this->receptionType = $receptionType;
return $this;
}
public function getFtpData(): ?array
{
return $this->ftpData;
}
public function setFtpData(?array $ftpData): self
{
$this->ftpData = $ftpData;
return $this;
}
public function getDueDate(): ?\DateTimeInterface
{
return $this->dueDate;
}
public function setDueDate(?\DateTimeInterface $dueDate): self
{
$this->dueDate = $dueDate;
return $this;
}
public function getEnableNotifications(): ?bool
{
return $this->enableNotifications;
}
public function setEnableNotifications(?bool $enableNotifications): self
{
$this->enableNotifications = $enableNotifications;
return $this;
}
public function getLang(): ?string
{
return $this->lang;
}
public function setLang(?string $lang): self
{
$this->lang = $lang;
return $this;
}
public function getOwner(): ?User
{
return $this->owner;
}
public function setOwner(?User $owner): self
{
$this->owner = $owner;
return $this;
}
public function getEntity(): ?DnsitEntity
{
return $this->entity;
}
public function setEntity(?DnsitEntity $entity): self
{
$this->entity = $entity;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getState(): ?int
{
return $this->state;
}
public function setState(?int $state): self
{
$this->state = $state;
return $this;
}
public function getDisabled(): ?bool
{
return $this->disabled;
}
public function setDisabled(bool $disabled): self
{
$this->disabled = $disabled;
return $this;
}
public function getPermanentFilename(): ?string
{
return $this->permanentFilename;
}
public function setPermanentFilename(?string $permanentFilename): self
{
$permanentFilename = PlanificationService::cleanFileName($permanentFilename);
$this->permanentFilename = $permanentFilename;
return $this;
}
public function getModeGuideAccueil(): ?bool
{
return $this->modeGuideAccueil;
}
public function setModeGuideAccueil(?bool $modeGuideAccueil): self
{
$this->modeGuideAccueil = $modeGuideAccueil;
return $this;
}
public function getSelectionGuideAccueil(): ?Selection
{
return $this->selectionGuideAccueil;
}
public function setSelectionGuideAccueil(?Selection $selectionGuideAccueil): self
{
$this->selectionGuideAccueil = $selectionGuideAccueil;
return $this;
}
public function getRayonGuideAccueil(): ?int
{
return $this->rayonGuideAccueil;
}
public function setRayonGuideAccueil(?int $rayonGuideAccueil): self
{
$this->rayonGuideAccueil = $rayonGuideAccueil;
return $this;
}
public function getFilterGuideAccueil(): ?string
{
return $this->filterGuideAccueil;
}
public function setFilterGuideAccueil(?string $filterGuideAccueil): self
{
$this->filterGuideAccueil = $filterGuideAccueil;
return $this;
}
/**
* @return Collection|EditionsPlanner[]
*/
public function getPlanners(): Collection
{
return $this->planners;
}
public function addPlanner(EditionsPlanner $planner): self
{
if (!$this->planners->contains($planner)) {
$this->planners[] = $planner;
$planner->setOwner($this);
}
return $this;
}
public function removePlanner(EditionsPlanner $planner): self
{
if ($this->planners->contains($planner)) {
$this->planners->removeElement($planner);
// set the owning side to null (unless already changed)
if ($planner->getOwner() === $this) {
$planner->setOwner(null);
}
}
return $this;
}
}