<?php
namespace App\Entity;
use App\Repository\VoyagePdfRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="walkinn_document_generator")
* @ORM\Entity(repositoryClass="App\Repository\DocumentGeneratorRepository")
*/
class DocumentGenerator
{
use \App\Traits\Timestampable;
use \App\Traits\Blameable;
use \App\Traits\ActivableBoolean;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $entite;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $langue;
/**
* @ORM\ManyToOne(targetEntity=DocumentGeneratorModele::class, inversedBy="documentGenerators")
*/
private $modele;
/**
* @ORM\OneToMany(targetEntity=DocumentGeneratorPage::class, mappedBy="documentGenerator")
* @ORM\OrderBy({"position" = "ASC"})
*/
private $documentGeneratorPages;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $entite_id;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $segmentPaxId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $entityIds;
public function __construct()
{
$this->documentGeneratorPages = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEntite(): ?string
{
return $this->entite;
}
public function setEntite(?string $entite): self
{
$this->entite = $entite;
return $this;
}
public function getLangue(): ?string
{
return $this->langue;
}
public function setLangue(?string $langue): self
{
$this->langue = $langue;
return $this;
}
public function getModele(): ?DocumentGeneratorModele
{
return $this->modele;
}
public function setModele(?DocumentGeneratorModele $modele): self
{
$this->modele = $modele;
return $this;
}
/**
* @return Collection|DocumentGeneratorPage[]
*/
public function getDocumentGeneratorPages(): Collection
{
$pages = new ArrayCollection();
// Filter
return $this->documentGeneratorPages->filter(function(DocumentGeneratorPage $page) {
return $page->getActif();
});
// OLD
/*
// Ne renvoie que les pages active
foreach ( $this->documentGeneratorPages as $page ) {
if ($page->getActif() == 1) {
$pages[] = $page;
}
}
return $pages;
// return $this->documentGeneratorPages;
*/
}
public function addDocumentGeneratorPage(DocumentGeneratorPage $documentGeneratorPage): self
{
if (!$this->documentGeneratorPages->contains($documentGeneratorPage)) {
$this->documentGeneratorPages[] = $documentGeneratorPage;
$documentGeneratorPage->setDocumentGenerator($this);
}
return $this;
}
public function removeDocumentGeneratorPage(DocumentGeneratorPage $documentGeneratorPage): self
{
if ($this->documentGeneratorPages->contains($documentGeneratorPage)) {
$this->documentGeneratorPages->removeElement($documentGeneratorPage);
// set the owning side to null (unless already changed)
if ($documentGeneratorPage->getDocumentGenerator() === $this) {
$documentGeneratorPage->setDocumentGenerator(null);
}
}
return $this;
}
public function getEntiteId(): ?int
{
return $this->entite_id;
}
public function setEntiteId(?int $entite_id): self
{
$this->entite_id = $entite_id;
return $this;
}
public function getSegmentPaxId(): ?int
{
return $this->segmentPaxId;
}
public function setSegmentPaxId(?int $segmentPaxId): self
{
$this->segmentPaxId = $segmentPaxId;
return $this;
}
public function getEntityIds(): ?string
{
return $this->entityIds;
}
public function setEntityIds(?string $entityIds): self
{
$this->entityIds = $entityIds;
return $this;
}
}