src/Entity/Document.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DocumentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassDocumentRepository::class)]
  9. class Document
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $label null;
  17.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  18.     private ?\DateTimeInterface $date_creation null;
  19.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  20.     private ?\DateTimeInterface $date_modification null;
  21.     #[ORM\OneToMany(mappedBy'document'targetEntitySection::class, cascade: ['remove''persist'])]
  22.     private Collection $sections;
  23.     #[ORM\ManyToOne(inversedBy'documents')]
  24.     private ?Dossier $dossier null;
  25.     #[ORM\Column(options: ["default" => false])]
  26.     private ?bool $biblio null;
  27.     #[ORM\Column(typeTypes::INTEGERoptions: ['default' => 1])]
  28.     private int $etat 1;
  29.     #[ORM\ManyToOne(inversedBy'documents')]
  30.     private ?Template $template null;
  31.     #[ORM\OneToMany(mappedBy'document'targetEntityVariablesGroup::class, cascade: ['remove''persist'])]
  32.     private Collection $variablesGroups;
  33.     #[ORM\OneToMany(mappedBy'document'targetEntityFichier::class, cascade: ['remove''persist'])]
  34.     private Collection $fichiers;
  35.     #[ORM\OneToMany(mappedBy'document'targetEntityVariableValue::class, cascade: ['remove''persist'])]
  36.     private Collection $variableValues;
  37.     public function __construct()
  38.     {
  39.         $this->sections = new ArrayCollection();
  40.         $this->variablesGroups = new ArrayCollection();
  41.         $this->fichiers = new ArrayCollection();
  42.         $this->variableValues = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getLabel(): ?string
  49.     {
  50.         return $this->label;
  51.     }
  52.     public function setLabel(string $label): static
  53.     {
  54.         $this->label $label;
  55.         return $this;
  56.     }
  57.     public function getDateCreation(): ?\DateTimeInterface
  58.     {
  59.         return $this->date_creation;
  60.     }
  61.     public function setDateCreation(\DateTimeInterface $date_creation): static
  62.     {
  63.         $this->date_creation $date_creation;
  64.         return $this;
  65.     }
  66.     public function getDateModification(): ?\DateTimeInterface
  67.     {
  68.         return $this->date_modification;
  69.     }
  70.     public function touchDateModification(): static
  71.     {
  72.         $this->date_modification = new \DateTime();
  73.         return $this;
  74.     }
  75.     /**
  76.      * @return Collection<int, Section>
  77.      */
  78.     public function getSections(): Collection
  79.     {
  80.         return $this->sections;
  81.     }
  82.     public function addSection(Section $section): static
  83.     {
  84.         if (!$this->sections->contains($section)) {
  85.             $this->sections->add($section);
  86.             $section->setDocument($this);
  87.         }
  88.         return $this;
  89.     }
  90.     public function removeSection(Section $section): static
  91.     {
  92.         if ($this->sections->removeElement($section)) {
  93.             // set the owning side to null (unless already changed)
  94.             if ($section->getDocument() === $this) {
  95.                 $section->setDocument(null);
  96.             }
  97.         }
  98.         return $this;
  99.     }
  100.     public function getDossier(): ?Dossier
  101.     {
  102.         return $this->dossier;
  103.     }
  104.     public function setDossier(?Dossier $dossier): static
  105.     {
  106.         $this->dossier $dossier;
  107.         return $this;
  108.     }
  109.     public function isBiblio(): ?bool
  110.     {
  111.         return $this->biblio;
  112.     }
  113.     public function setBiblio(bool $biblio): static
  114.     {
  115.         $this->biblio $biblio;
  116.         return $this;
  117.     }
  118.     public function getTemplate(): ?Template
  119.     {
  120.         return $this->template;
  121.     }
  122.     public function setTemplate(?Template $template): static
  123.     {
  124.         $this->template $template;
  125.         return $this;
  126.     }
  127.     public function setVariablesGroups(Collection $variablesGroups): static
  128.     {
  129.         $this->variablesGroups $variablesGroups;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection<int, VariablesGroup>
  134.      */
  135.     public function getVariablesGroups(): Collection
  136.     {
  137.         // Document variables don't need sorting - they're managed directly
  138.         return $this->variablesGroups;
  139.     }
  140.     public function addVariablesGroup(VariablesGroup $variablesGroup): static
  141.     {
  142.         if (!$this->variablesGroups->contains($variablesGroup)) {
  143.             $this->variablesGroups->add($variablesGroup);
  144.             $variablesGroup->setDocument($this);
  145.         }
  146.         return $this;
  147.     }
  148.     public function removeVariablesGroup(VariablesGroup $variablesGroup): static
  149.     {
  150.         if ($this->variablesGroups->removeElement($variablesGroup)) {
  151.             // set the owning side to null (unless already changed)
  152.             if ($variablesGroup->getDocument() === $this) {
  153.                 $variablesGroup->setDocument(null);
  154.             }
  155.         }
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return Collection<int, Fichier>
  160.      */
  161.     public function getFichiers(): Collection
  162.     {
  163.         return $this->fichiers;
  164.     }
  165.     public function addFichier(Fichier $fichier): static
  166.     {
  167.         if (!$this->fichiers->contains($fichier)) {
  168.             $this->fichiers->add($fichier);
  169.             $fichier->setDocument($this);
  170.         }
  171.         return $this;
  172.     }
  173.     public function removeFichier(Fichier $fichier): static
  174.     {
  175.         if ($this->fichiers->removeElement($fichier)) {
  176.             // set the owning side to null (unless already changed)
  177.             if ($fichier->getDocument() === $this) {
  178.                 $fichier->setDocument(null);
  179.             }
  180.         }
  181.         return $this;
  182.     }
  183.     public function getBlocs(): array
  184.     {
  185.         $blocs = [];
  186.         foreach ($this->sections as $section) {
  187.             foreach ($section->getBlocs() as $bloc) {
  188.                 $blocs[] = $bloc;
  189.             }
  190.         }
  191.         return $blocs;
  192.     }
  193.     /**
  194.      * @return Collection<int, VariableValue>
  195.      */
  196.     public function getVariableValues(): Collection
  197.     {
  198.         return $this->variableValues;
  199.     }
  200.     public function addVariableValue(VariableValue $variableValue): static
  201.     {
  202.         if (!$this->variableValues->contains($variableValue)) {
  203.             $this->variableValues->add($variableValue);
  204.             $variableValue->setDocument($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeVariableValue(VariableValue $variableValue): static
  209.     {
  210.         if ($this->variableValues->removeElement($variableValue)) {
  211.             // set the owning side to null (unless already changed)
  212.             if ($variableValue->getDocument() === $this) {
  213.                 $variableValue->setDocument(null);
  214.             }
  215.         }
  216.         return $this;
  217.     }
  218.     public function getEtat(): int
  219.     {
  220.         return $this->etat;
  221.     }
  222.     public function setEtat(int $etat): static
  223.     {
  224.         $this->etat $etat;
  225.         return $this;
  226.     }
  227. }