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