src/Entity/Folder.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FolderRepository;
  4. use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=FolderRepository::class)
  10.  * @ORM\Table(indexes={@ORM\Index(name="idx_folder_status", columns={"status"})})
  11.  * @Auditable
  12.  */
  13. class Folder
  14. {
  15.     /**
  16.      * @ORM\Id()
  17.      * @ORM\GeneratedValue()
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity=Users::class)
  23.      * @ORM\JoinColumn(nullable=false)
  24.      */
  25.     private $userCreate;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Users::class)
  28.      */
  29.     private $userValidation;
  30.     /**
  31.      * @ORM\Column(type="integer", nullable=true)
  32.      */
  33.     private $status;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=DocumentCategory::class, fetch="EXTRA_LAZY")
  36.      * @ORM\JoinColumn(nullable=false)
  37.      */
  38.     private $documentCategory;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=Sites::class)
  41.      */
  42.     private $site;
  43.     /**
  44.      * @ORM\Column(type="boolean", nullable=true)
  45.      */
  46.     private $isDeleted;
  47.     /**
  48.      * @ORM\Column(type="datetime", nullable=true)
  49.      */
  50.     private $dateValidation;
  51.     /**
  52.      * @ORM\Column(type="datetime", nullable=true)
  53.      */
  54.     private $dateCreate;
  55.     /**
  56.      * @ORM\Column(type="datetime", nullable=true)
  57.      */
  58.     private $dateUpdate;
  59.     /**
  60.      * @ORM\Column(type="datetime", nullable=true)
  61.      */
  62.     private $dateSign;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity=Users::class)
  65.      */
  66.     private $userUpdate;
  67.     /**
  68.      * @ORM\ManyToOne(targetEntity=Users::class)
  69.      */
  70.     private $userAutority;
  71.     /**
  72.      * @ORM\ManyToOne(targetEntity=Identite::class, fetch="EAGER")
  73.      */
  74.     private $beneficiary;
  75.     /**
  76.      * @ORM\Column(type="string", length=255, nullable=true)
  77.      */
  78.     private $requestId;
  79.     /**
  80.      * @ORM\Column(type="string", length=255, nullable=true)
  81.      */
  82.     private $authorityName;
  83.     /**
  84.      * @ORM\Column(type="string", length=255, nullable=true)
  85.      */
  86.     private $number;
  87.     /**
  88.      * @ORM\OneToMany(targetEntity=Bills::class, mappedBy="folder")
  89.      */
  90.     private $bill;
  91.     /**
  92.      * @ORM\OneToMany(targetEntity=FormValues::class, mappedBy="folder")
  93.      */
  94.     private $formValues;
  95.     /**
  96.      * @ORM\OneToMany(targetEntity=Document::class, mappedBy="folder", orphanRemoval=true, fetch="EXTRA_LAZY")
  97.      */
  98.     private $documents;
  99.     /**
  100.      * @ORM\OneToMany(targetEntity=RejectedFolder::class, mappedBy="folder", orphanRemoval=true)
  101.      */
  102.     private $rejectedFolders;
  103.     /**
  104.      * @ORM\OneToMany(targetEntity=ReturnedFolder::class, mappedBy="folder", orphanRemoval=true)
  105.      */
  106.     private $returnedFolders;
  107.     /**
  108.      * @ORM\Column(type="datetime", nullable=true)
  109.      */
  110.     private $dateCancellation;
  111.     /**
  112.      * @ORM\ManyToOne(targetEntity=Users::class)
  113.      */
  114.     private $userCancellation;
  115.     /**
  116.      * @ORM\Column(type="text", nullable=true)
  117.      */
  118.     private $cancellationComment;
  119.     /**
  120.      * @ORM\ManyToOne(targetEntity=Pcode::class)
  121.      */
  122.     private $pcode;
  123.     /**
  124.      * @ORM\OneToMany(targetEntity=FolderHistory::class, mappedBy="folder")
  125.      */
  126.     private $folderHistories;
  127.     /**
  128.      * @ORM\Column(type="string", length=255, nullable=true)
  129.      */
  130.     private $numeroQr;
  131.     /**
  132.      * @ORM\Column(type="boolean")
  133.      */
  134.     private $approved;
  135.     /**
  136.      * @ORM\ManyToOne(targetEntity=Users::class)
  137.      */
  138.     private $approvedBy;
  139.     /**
  140.      * @ORM\Column(type="datetime_immutable", nullable=true)
  141.      */
  142.     private $approvedAt;
  143.     /**
  144.      * @ORM\Column(type="boolean")
  145.      */
  146.     private $toDeliver;
  147.     public function __construct()
  148.     {
  149.         $this->isDeleted false;
  150.         $this->dateCreate = new \DateTime();
  151.         $this->status 1;
  152.         $this->number  "D-" ucfirst(uniqid());
  153.         $this->bill = new ArrayCollection();
  154.         $this->formValues = new ArrayCollection();
  155.         $this->documents = new ArrayCollection();
  156.         $this->approved false;
  157.         $this->toDeliver false;
  158.         $this->rejectedFolders = new ArrayCollection();
  159.         $this->returnedFolders = new ArrayCollection();
  160.         $this->folderHistories = new ArrayCollection();
  161.     }
  162.     public function getId(): ?int
  163.     {
  164.         return $this->id;
  165.     }
  166.     public function setId(int $id): self
  167.     {
  168.         $this->id $id;
  169.         return $this;
  170.     }
  171.     public function getUserCreate(): ?Users
  172.     {
  173.         return $this->userCreate;
  174.     }
  175.     public function setUserCreate(?Users $userCreate): self
  176.     {
  177.         $this->userCreate $userCreate;
  178.         return $this;
  179.     }
  180.     public function getUserAutority(): ?Users
  181.     {
  182.         return $this->userAutority;
  183.     }
  184.     public function setUserAutority(?Users $userAutority): self
  185.     {
  186.         $this->userAutority $userAutority;
  187.         return $this;
  188.     }
  189.     public function getDateValidation(): ?\DateTimeInterface
  190.     {
  191.         return $this->dateValidation;
  192.     }
  193.     public function setDateValidation(\DateTimeInterface $dateValidation): self
  194.     {
  195.         $this->dateValidation $dateValidation;
  196.         return $this;
  197.     }
  198.     public function getDateSign(): ?\DateTimeInterface
  199.     {
  200.         return $this->dateSign;
  201.     }
  202.     public function setDateSign(\DateTimeInterface $dateSign): self
  203.     {
  204.         $this->dateSign $dateSign;
  205.         return $this;
  206.     }
  207.     public function getUserValidation(): ?Users
  208.     {
  209.         return $this->userValidation;
  210.     }
  211.     public function setUserValidation(?Users $userValidation): self
  212.     {
  213.         $this->userValidation $userValidation;
  214.         return $this;
  215.     }
  216.     public function getStatus(): ?int
  217.     {
  218.         return $this->status;
  219.     }
  220.     public function setStatus(?int $status): self
  221.     {
  222.         $this->status $status;
  223.         return $this;
  224.     }
  225.     public function getDocumentCategory(): ?DocumentCategory
  226.     {
  227.         return $this->documentCategory;
  228.     }
  229.     public function setDocumentCategory(?DocumentCategory $documentCategory): self
  230.     {
  231.         $this->documentCategory $documentCategory;
  232.         return $this;
  233.     }
  234.     public function getSite(): ?Sites
  235.     {
  236.         return $this->site;
  237.     }
  238.     public function setSite(?Sites $site): self
  239.     {
  240.         $this->site $site;
  241.         return $this;
  242.     }
  243.     public function getIsDeleted(): ?bool
  244.     {
  245.         return $this->isDeleted;
  246.     }
  247.     public function setIsDeleted(?bool $isDeleted): self
  248.     {
  249.         $this->isDeleted $isDeleted;
  250.         return $this;
  251.     }
  252.     public function getDateCreate(): ?\DateTimeInterface
  253.     {
  254.         return $this->dateCreate;
  255.     }
  256.     public function setDateCreate(?\DateTimeInterface $dateCreate): self
  257.     {
  258.         $this->dateCreate $dateCreate;
  259.         return $this;
  260.     }
  261.     public function getDateUpdate(): ?\DateTimeInterface
  262.     {
  263.         return $this->dateUpdate;
  264.     }
  265.     public function setDateUpdate(?\DateTimeInterface $dateUpdate): self
  266.     {
  267.         $this->dateUpdate $dateUpdate;
  268.         return $this;
  269.     }
  270.     public function getUserUpdate(): ?Users
  271.     {
  272.         return $this->userUpdate;
  273.     }
  274.     public function setUserUpdate(?Users $userUpdate): self
  275.     {
  276.         $this->userUpdate $userUpdate;
  277.         return $this;
  278.     }
  279.     public function getBeneficiary(): ?Identite
  280.     {
  281.         return $this->beneficiary;
  282.     }
  283.     public function setBeneficiary(?Identite $beneficiary): self
  284.     {
  285.         $this->beneficiary $beneficiary;
  286.         return $this;
  287.     }
  288.     public function getRequestId(): ?string
  289.     {
  290.         return $this->requestId;
  291.     }
  292.     public function setRequestId(?string $requestId): self
  293.     {
  294.         $this->requestId $requestId;
  295.         return $this;
  296.     }
  297.     public function getAuthorityName(): ?string
  298.     {
  299.         return $this->authorityName;
  300.     }
  301.     public function setAuthorityName(?string $authorityName): self
  302.     {
  303.         $this->authorityName $authorityName;
  304.         return $this;
  305.     }
  306.     public function getNumber(): ?string
  307.     {
  308.         return $this->number;
  309.     }
  310.     public function setNumber(?string $number): self
  311.     {
  312.         $this->number $number;
  313.         return $this;
  314.     }
  315.     /**
  316.      * @return Collection|Bills[]
  317.      */
  318.     public function getBill(): Collection
  319.     {
  320.         return $this->bill;
  321.     }
  322.     public function addBill(Bills $bill): self
  323.     {
  324.         if (!$this->bill->contains($bill)) {
  325.             $this->bill[] = $bill;
  326.             $bill->setFolder($this);
  327.         }
  328.         return $this;
  329.     }
  330.     public function removeBill(Bills $bill): self
  331.     {
  332.         if ($this->bill->removeElement($bill)) {
  333.             // set the owning side to null (unless already changed)
  334.             if ($bill->getFolder() === $this) {
  335.                 $bill->setFolder(null);
  336.             }
  337.         }
  338.         return $this;
  339.     }
  340.     /**
  341.      * @return Collection|FormValues[]
  342.      */
  343.     public function getFormValues(): Collection
  344.     {
  345.         return $this->formValues;
  346.     }
  347.     public function addFormValue(FormValues $formValue): self
  348.     {
  349.         if (!$this->formValues->contains($formValue)) {
  350.             $this->formValues[] = $formValue;
  351.             $formValue->setFolder($this);
  352.         }
  353.         return $this;
  354.     }
  355.     public function removeFormValue(FormValues $formValue): self
  356.     {
  357.         if ($this->formValues->removeElement($formValue)) {
  358.             // set the owning side to null (unless already changed)
  359.             if ($formValue->getFolder() === $this) {
  360.                 $formValue->setFolder(null);
  361.             }
  362.         }
  363.         return $this;
  364.     }
  365.     /**
  366.      * @return Collection|Document[]
  367.      */
  368.     public function getDocuments(): Collection
  369.     {
  370.         return $this->documents;
  371.     }
  372.     public function addDocument(Document $document): self
  373.     {
  374.         if (!$this->documents->contains($document)) {
  375.             $this->documents[] = $document;
  376.             $document->setFolder($this);
  377.         }
  378.         return $this;
  379.     }
  380.     public function removeDocument(Document $document): self
  381.     {
  382.         if ($this->documents->removeElement($document)) {
  383.             // set the owning side to null (unless already changed)
  384.             if ($document->getFolder() === $this) {
  385.                 $document->setFolder(null);
  386.             }
  387.         }
  388.         return $this;
  389.     }
  390.     /**
  391.      * @return Collection|RejectedFolder[]
  392.      */
  393.     public function getRejectedFolders(): Collection
  394.     {
  395.         return $this->rejectedFolders;
  396.     }
  397.     public function addRejectedFolder(RejectedFolder $rejectedFolder): self
  398.     {
  399.         if (!$this->rejectedFolders->contains($rejectedFolder)) {
  400.             $this->rejectedFolders[] = $rejectedFolder;
  401.             $rejectedFolder->setFolder($this);
  402.         }
  403.         return $this;
  404.     }
  405.     public function removeRejectedFolder(RejectedFolder $rejectedFolder): self
  406.     {
  407.         if ($this->rejectedFolders->removeElement($rejectedFolder)) {
  408.             // set the owning side to null (unless already changed)
  409.             if ($rejectedFolder->getFolder() === $this) {
  410.                 $rejectedFolder->setFolder(null);
  411.             }
  412.         }
  413.         return $this;
  414.     }
  415.     /**
  416.      * @return Collection|ReturnedFolder[]
  417.      */
  418.     public function getReturnedFolders(): Collection
  419.     {
  420.         return $this->returnedFolders;
  421.     }
  422.     public function addReturnedFolder(ReturnedFolder $returnedFolder): self
  423.     {
  424.         if (!$this->returnedFolders->contains($returnedFolder)) {
  425.             $this->returnedFolders[] = $returnedFolder;
  426.             $returnedFolder->setFolder($this);
  427.         }
  428.         return $this;
  429.     }
  430.     public function removeReturnedFolder(ReturnedFolder $returnedFolder): self
  431.     {
  432.         if ($this->returnedFolders->removeElement($returnedFolder)) {
  433.             // set the owning side to null (unless already changed)
  434.             if ($returnedFolder->getFolder() === $this) {
  435.                 $returnedFolder->setFolder(null);
  436.             }
  437.         }
  438.         return $this;
  439.     }
  440.     public function getDateCancellation(): ?\DateTimeInterface
  441.     {
  442.         return $this->dateCancellation;
  443.     }
  444.     public function setDateCancellation(?\DateTimeInterface $dateCancellation): self
  445.     {
  446.         $this->dateCancellation $dateCancellation;
  447.         return $this;
  448.     }
  449.     public function getUserCancellation(): ?Users
  450.     {
  451.         return $this->userCancellation;
  452.     }
  453.     public function setUserCancellation(?Users $userCancellation): self
  454.     {
  455.         $this->userCancellation $userCancellation;
  456.         return $this;
  457.     }
  458.     public function getCancellationComment(): ?string
  459.     {
  460.         return $this->cancellationComment;
  461.     }
  462.     public function setCancellationComment(?string $cancellationComment): self
  463.     {
  464.         $this->cancellationComment $cancellationComment;
  465.         return $this;
  466.     }
  467.     public function getPcode(): ?Pcode
  468.     {
  469.         return $this->pcode;
  470.     }
  471.     public function setPcode(?Pcode $pcode): self
  472.     {
  473.         $this->pcode $pcode;
  474.         return $this;
  475.     }
  476.     /**
  477.      * @return Collection<int, FolderHistory>
  478.      */
  479.     public function getFolderHistories(): Collection
  480.     {
  481.         return $this->folderHistories;
  482.     }
  483.     public function addFolderHistory(FolderHistory $folderHistory): self
  484.     {
  485.         if (!$this->folderHistories->contains($folderHistory)) {
  486.             $this->folderHistories[] = $folderHistory;
  487.             $folderHistory->setFolder($this);
  488.         }
  489.         return $this;
  490.     }
  491.     public function removeFolderHistory(FolderHistory $folderHistory): self
  492.     {
  493.         if ($this->folderHistories->removeElement($folderHistory)) {
  494.             // set the owning side to null (unless already changed)
  495.             if ($folderHistory->getFolder() === $this) {
  496.                 $folderHistory->setFolder(null);
  497.             }
  498.         }
  499.         return $this;
  500.     }
  501.     public function getNumeroQr(): ?string
  502.     {
  503.         return $this->numeroQr;
  504.     }
  505.     public function setNumeroQr(?string $numeroQr): self
  506.     {
  507.         $this->numeroQr $numeroQr;
  508.         return $this;
  509.     }
  510.     public function isApproved(): ?bool
  511.     {
  512.         return $this->approved;
  513.     }
  514.     public function setApproved(bool $approved): self
  515.     {
  516.         $this->approved $approved;
  517.         return $this;
  518.     }
  519.     public function getApprovedBy(): ?Users
  520.     {
  521.         return $this->approvedBy;
  522.     }
  523.     public function setApprovedBy(?Users $approvedBy): self
  524.     {
  525.         $this->approvedBy $approvedBy;
  526.         return $this;
  527.     }
  528.     public function getApprovedAt(): ?\DateTimeImmutable
  529.     {
  530.         return $this->approvedAt;
  531.     }
  532.     public function setApprovedAt(?\DateTimeImmutable $approvedAt): self
  533.     {
  534.         $this->approvedAt $approvedAt;
  535.         return $this;
  536.     }
  537.     public function isToDeliver(): ?bool
  538.     {
  539.         return $this->toDeliver;
  540.     }
  541.     public function setToDeliver(bool $toDeliver): self
  542.     {
  543.         $this->toDeliver $toDeliver;
  544.         return $this;
  545.     }
  546. }