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\ManyToOne(inversedBy'documents')]
  16.     private ?Project $projet null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $label null;
  19.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  20.     private ?\DateTimeInterface $date_creation 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\ManyToOne(inversedBy'documents')]
  26.     private ?DossierDocType $doc_type null;
  27.     #[ORM\Column(options: ["default" => false])]
  28.     private ?bool $biblio null;
  29.     #[ORM\ManyToOne(inversedBy'documents')]
  30.     private ?Template $template null;
  31.     // Add cascade={"persist"} for VariablesGroup relationship
  32.     #[ORM\OneToMany(mappedBy'document'targetEntityVariablesGroup::class, cascade: ['remove''persist'])]
  33.     private Collection $variablesGroups;
  34.     // Add cascade={"persist"} for Fichier relationship
  35.     #[ORM\OneToMany(mappedBy'document'targetEntityFichier::class, cascade: ['remove''persist'])]
  36.     private Collection $fichiers;
  37.     // Add cascade={"persist"} for Bloc relationship
  38.     #[ORM\OneToMany(mappedBy'document'targetEntityBloc::class, cascade: ['remove''persist'])]
  39.     private Collection $blocs;
  40.     // Add cascade={"persist"} for VariableValue relationship
  41.     #[ORM\OneToMany(mappedBy'document'targetEntityVariableValue::class, cascade: ['remove''persist'])]
  42.     private Collection $variableValues;
  43.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'parent')]
  44.     private ?self $document null;
  45.     #[ORM\OneToMany(mappedBy'document'targetEntityself::class)]
  46.     private Collection $parent;
  47.     public function __construct()
  48.     {
  49.         $this->sections = new ArrayCollection();
  50.         $this->variablesGroups = new ArrayCollection();
  51.         $this->fichiers = new ArrayCollection();
  52.         $this->blocs = new ArrayCollection();
  53.         $this->variableValues = new ArrayCollection();
  54.         $this->parent = new ArrayCollection();
  55.     }
  56.     public function getId(): ?int
  57.     {
  58.         return $this->id;
  59.     }
  60.     public function getProjet(): ?Project
  61.     {
  62.         return $this->projet;
  63.     }
  64.     public function setProjet(?Project $projet): static
  65.     {
  66.         $this->projet $projet;
  67.         return $this;
  68.     }
  69.     public function getLabel(): ?string
  70.     {
  71.         return $this->label;
  72.     }
  73.     public function setLabel(string $label): static
  74.     {
  75.         $this->label $label;
  76.         return $this;
  77.     }
  78.     public function getDateCreation(): ?\DateTimeInterface
  79.     {
  80.         return $this->date_creation;
  81.     }
  82.     public function setDateCreation(\DateTimeInterface $date_creation): static
  83.     {
  84.         $this->date_creation $date_creation;
  85.         return $this;
  86.     }
  87.     // Add this method to get the associated Project
  88.     public function getProject(): ?Project
  89.     {
  90.         return $this->getProjet();
  91.     }
  92.     /**
  93.      * @return Collection<int, Section>
  94.      */
  95.     public function getSections(): Collection
  96.     {
  97.         return $this->sections;
  98.     }
  99.     public function addSection(Section $section): static
  100.     {
  101.         if (!$this->sections->contains($section)) {
  102.             $this->sections->add($section);
  103.             $section->setDocument($this);
  104.         }
  105.         return $this;
  106.     }
  107.     public function removeSection(Section $section): static
  108.     {
  109.         if ($this->sections->removeElement($section)) {
  110.             // set the owning side to null (unless already changed)
  111.             if ($section->getDocument() === $this) {
  112.                 $section->setDocument(null);
  113.             }
  114.         }
  115.         return $this;
  116.     }
  117.     public function getDossier(): ?Dossier
  118.     {
  119.         return $this->dossier;
  120.     }
  121.     public function setDossier(?Dossier $dossier): static
  122.     {
  123.         $this->dossier $dossier;
  124.         return $this;
  125.     }
  126.     public function getDocType(): ?DossierDocType
  127.     {
  128.         return $this->doc_type;
  129.     }
  130.     public function setDocType(?DossierDocType $doc_type): static
  131.     {
  132.         $this->doc_type $doc_type;
  133.         return $this;
  134.     }
  135.     public function isBiblio(): ?bool
  136.     {
  137.         return $this->biblio;
  138.     }
  139.     public function setBiblio(bool $biblio): static
  140.     {
  141.         $this->biblio $biblio;
  142.         return $this;
  143.     }
  144.     public function getTemplate(): ?Template
  145.     {
  146.         return $this->template;
  147.     }
  148.     public function setTemplate(?Template $template): static
  149.     {
  150.         $this->template $template;
  151.         return $this;
  152.     }
  153.     /**
  154.      * @return Collection<int, VariablesGroup>
  155.      */
  156.     public function getVariablesGroups(): Collection
  157.     {
  158.         return $this->variablesGroups;
  159.     }
  160.     public function addVariablesGroup(VariablesGroup $variablesGroup): static
  161.     {
  162.         if (!$this->variablesGroups->contains($variablesGroup)) {
  163.             $this->variablesGroups->add($variablesGroup);
  164.             $variablesGroup->setDocument($this);
  165.         }
  166.         return $this;
  167.     }
  168.     public function removeVariablesGroup(VariablesGroup $variablesGroup): static
  169.     {
  170.         if ($this->variablesGroups->removeElement($variablesGroup)) {
  171.             // set the owning side to null (unless already changed)
  172.             if ($variablesGroup->getDocument() === $this) {
  173.                 $variablesGroup->setDocument(null);
  174.             }
  175.         }
  176.         return $this;
  177.     }
  178.     /**
  179.      * @return Collection<int, Fichier>
  180.      */
  181.     public function getFichiers(): Collection
  182.     {
  183.         return $this->fichiers;
  184.     }
  185.     public function addFichier(Fichier $fichier): static
  186.     {
  187.         if (!$this->fichiers->contains($fichier)) {
  188.             $this->fichiers->add($fichier);
  189.             $fichier->setDocument($this);
  190.         }
  191.         return $this;
  192.     }
  193.     public function removeFichier(Fichier $fichier): static
  194.     {
  195.         if ($this->fichiers->removeElement($fichier)) {
  196.             // set the owning side to null (unless already changed)
  197.             if ($fichier->getDocument() === $this) {
  198.                 $fichier->setDocument(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203.     /**
  204.      * @return Collection<int, Bloc>
  205.      */
  206.     public function getBlocs(): Collection
  207.     {
  208.         return $this->blocs;
  209.     }
  210.     public function addBloc(Bloc $bloc): static
  211.     {
  212.         if (!$this->blocs->contains($bloc)) {
  213.             $this->blocs->add($bloc);
  214.             $bloc->setDocument($this);
  215.         }
  216.         return $this;
  217.     }
  218.     public function removeBloc(Bloc $bloc): static
  219.     {
  220.         if ($this->blocs->removeElement($bloc)) {
  221.             // set the owning side to null (unless already changed)
  222.             if ($bloc->getDocument() === $this) {
  223.                 $bloc->setDocument(null);
  224.             }
  225.         }
  226.         return $this;
  227.     }
  228.     /**
  229.      * @return Collection<int, VariableValue>
  230.      */
  231.     public function getVariableValues(): Collection
  232.     {
  233.         return $this->variableValues;
  234.     }
  235.     public function addVariableValue(VariableValue $variableValue): static
  236.     {
  237.         if (!$this->variableValues->contains($variableValue)) {
  238.             $this->variableValues->add($variableValue);
  239.             $variableValue->setDocument($this);
  240.         }
  241.         return $this;
  242.     }
  243.     public function removeVariableValue(VariableValue $variableValue): static
  244.     {
  245.         if ($this->variableValues->removeElement($variableValue)) {
  246.             // set the owning side to null (unless already changed)
  247.             if ($variableValue->getDocument() === $this) {
  248.                 $variableValue->setDocument(null);
  249.             }
  250.         }
  251.         return $this;
  252.     }
  253.     public function getDocument(): ?self
  254.     {
  255.         return $this->document;
  256.     }
  257.     public function setDocument(?self $document): static
  258.     {
  259.         $this->document $document;
  260.         return $this;
  261.     }
  262.     /**
  263.      * @return Collection<int, self>
  264.      */
  265.     public function getParent(): Collection
  266.     {
  267.         return $this->parent;
  268.     }
  269.     public function addParent(self $parent): static
  270.     {
  271.         if (!$this->parent->contains($parent)) {
  272.             $this->parent->add($parent);
  273.             $parent->setDocument($this);
  274.         }
  275.         return $this;
  276.     }
  277.     public function removeParent(self $parent): static
  278.     {
  279.         if ($this->parent->removeElement($parent)) {
  280.             // set the owning side to null (unless already changed)
  281.             if ($parent->getDocument() === $this) {
  282.                 $parent->setDocument(null);
  283.             }
  284.         }
  285.         return $this;
  286.     }
  287. }