src/Entity/DocumentGenerator.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VoyagePdfRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="walkinn_document_generator") 
  9.  * @ORM\Entity(repositoryClass="App\Repository\DocumentGeneratorRepository")
  10.  */
  11. class DocumentGenerator 
  12. {
  13.     use \App\Traits\Timestampable;
  14.     use \App\Traits\Blameable;
  15.     use \App\Traits\ActivableBoolean;
  16.     /**
  17.      * @ORM\Id()
  18.      * @ORM\GeneratedValue()
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $entite;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $langue;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=DocumentGeneratorModele::class, inversedBy="documentGenerators")
  32.      */
  33.     private $modele;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=DocumentGeneratorPage::class, mappedBy="documentGenerator")
  36.      * @ORM\OrderBy({"position" = "ASC"})
  37.      */
  38.     private $documentGeneratorPages;
  39.     /**
  40.      * @ORM\Column(type="integer", nullable=true)
  41.      */
  42.     private $entite_id;
  43.     /**
  44.      * @ORM\Column(type="integer", nullable=true)
  45.      */
  46.     private $segmentPaxId;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      */
  50.     private $entityIds;
  51.     public function __construct()
  52.     {
  53.         $this->documentGeneratorPages = new ArrayCollection();
  54.     }
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getEntite(): ?string
  60.     {
  61.         return $this->entite;
  62.     }
  63.     public function setEntite(?string $entite): self
  64.     {
  65.         $this->entite $entite;
  66.         return $this;
  67.     }
  68.     public function getLangue(): ?string
  69.     {
  70.         return $this->langue;
  71.     }
  72.     public function setLangue(?string $langue): self
  73.     {
  74.         $this->langue $langue;
  75.         return $this;
  76.     }
  77.     public function getModele(): ?DocumentGeneratorModele
  78.     {
  79.         return $this->modele;
  80.     }
  81.     public function setModele(?DocumentGeneratorModele $modele): self
  82.     {
  83.         $this->modele $modele;
  84.         return $this;
  85.     }
  86.     /**
  87.      * @return Collection|DocumentGeneratorPage[]
  88.      */
  89.     public function getDocumentGeneratorPages(): Collection
  90.     {
  91.         $pages = new ArrayCollection();
  92.         // Filter
  93.         return $this->documentGeneratorPages->filter(function(DocumentGeneratorPage $page) {
  94.             return $page->getActif();
  95.         });
  96.         
  97.         // OLD
  98.         /*
  99.         // Ne renvoie que les pages active
  100.         foreach ( $this->documentGeneratorPages as $page ) {
  101.             if ($page->getActif() == 1) {
  102.                 $pages[] = $page;
  103.             }
  104.         }
  105.         return $pages;
  106.         // return $this->documentGeneratorPages;
  107.         */
  108.     }
  109.     public function addDocumentGeneratorPage(DocumentGeneratorPage $documentGeneratorPage): self
  110.     {
  111.         if (!$this->documentGeneratorPages->contains($documentGeneratorPage)) {
  112.             $this->documentGeneratorPages[] = $documentGeneratorPage;
  113.             $documentGeneratorPage->setDocumentGenerator($this);
  114.         }
  115.         return $this;
  116.     }
  117.     public function removeDocumentGeneratorPage(DocumentGeneratorPage $documentGeneratorPage): self
  118.     {
  119.         if ($this->documentGeneratorPages->contains($documentGeneratorPage)) {
  120.             $this->documentGeneratorPages->removeElement($documentGeneratorPage);
  121.             // set the owning side to null (unless already changed)
  122.             if ($documentGeneratorPage->getDocumentGenerator() === $this) {
  123.                 $documentGeneratorPage->setDocumentGenerator(null);
  124.             }
  125.         }
  126.         return $this;
  127.     }
  128.     public function getEntiteId(): ?int
  129.     {
  130.         return $this->entite_id;
  131.     }
  132.     public function setEntiteId(?int $entite_id): self
  133.     {
  134.         $this->entite_id $entite_id;
  135.         return $this;
  136.     }
  137.     public function getSegmentPaxId(): ?int
  138.     {
  139.         return $this->segmentPaxId;
  140.     }
  141.     public function setSegmentPaxId(?int $segmentPaxId): self
  142.     {
  143.         $this->segmentPaxId $segmentPaxId;
  144.         return $this;
  145.     }
  146.     public function getEntityIds(): ?string
  147.     {
  148.         return $this->entityIds;
  149.     }
  150.     public function setEntityIds(?string $entityIds): self
  151.     {
  152.         $this->entityIds $entityIds;
  153.         return $this;
  154.     }
  155. }