<?php
namespace App\Entity;
use App\Repository\FolderRepository;
use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=FolderRepository::class)
* @ORM\Table(indexes={@ORM\Index(name="idx_folder_status", columns={"status"})})
* @Auditable
*/
class Folder
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Users::class)
* @ORM\JoinColumn(nullable=false)
*/
private $userCreate;
/**
* @ORM\ManyToOne(targetEntity=Users::class)
*/
private $userValidation;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $status;
/**
* @ORM\ManyToOne(targetEntity=DocumentCategory::class, fetch="EXTRA_LAZY")
* @ORM\JoinColumn(nullable=false)
*/
private $documentCategory;
/**
* @ORM\ManyToOne(targetEntity=Sites::class)
*/
private $site;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isDeleted;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateValidation;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateCreate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateUpdate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateSign;
/**
* @ORM\ManyToOne(targetEntity=Users::class)
*/
private $userUpdate;
/**
* @ORM\ManyToOne(targetEntity=Users::class)
*/
private $userAutority;
/**
* @ORM\ManyToOne(targetEntity=Identite::class, fetch="EAGER")
*/
private $beneficiary;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $requestId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $authorityName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $number;
/**
* @ORM\OneToMany(targetEntity=Bills::class, mappedBy="folder")
*/
private $bill;
/**
* @ORM\OneToMany(targetEntity=FormValues::class, mappedBy="folder")
*/
private $formValues;
/**
* @ORM\OneToMany(targetEntity=Document::class, mappedBy="folder", orphanRemoval=true, fetch="EXTRA_LAZY")
*/
private $documents;
/**
* @ORM\OneToMany(targetEntity=RejectedFolder::class, mappedBy="folder", orphanRemoval=true)
*/
private $rejectedFolders;
/**
* @ORM\OneToMany(targetEntity=ReturnedFolder::class, mappedBy="folder", orphanRemoval=true)
*/
private $returnedFolders;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateCancellation;
/**
* @ORM\ManyToOne(targetEntity=Users::class)
*/
private $userCancellation;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $cancellationComment;
/**
* @ORM\ManyToOne(targetEntity=Pcode::class)
*/
private $pcode;
/**
* @ORM\OneToMany(targetEntity=FolderHistory::class, mappedBy="folder")
*/
private $folderHistories;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $numeroQr;
/**
* @ORM\Column(type="boolean")
*/
private $approved;
/**
* @ORM\ManyToOne(targetEntity=Users::class)
*/
private $approvedBy;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $approvedAt;
/**
* @ORM\Column(type="boolean")
*/
private $toDeliver;
public function __construct()
{
$this->isDeleted = false;
$this->dateCreate = new \DateTime();
$this->status = 1;
$this->number = "D-" . ucfirst(uniqid());
$this->bill = new ArrayCollection();
$this->formValues = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->approved = false;
$this->toDeliver = false;
$this->rejectedFolders = new ArrayCollection();
$this->returnedFolders = new ArrayCollection();
$this->folderHistories = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getUserCreate(): ?Users
{
return $this->userCreate;
}
public function setUserCreate(?Users $userCreate): self
{
$this->userCreate = $userCreate;
return $this;
}
public function getUserAutority(): ?Users
{
return $this->userAutority;
}
public function setUserAutority(?Users $userAutority): self
{
$this->userAutority = $userAutority;
return $this;
}
public function getDateValidation(): ?\DateTimeInterface
{
return $this->dateValidation;
}
public function setDateValidation(\DateTimeInterface $dateValidation): self
{
$this->dateValidation = $dateValidation;
return $this;
}
public function getDateSign(): ?\DateTimeInterface
{
return $this->dateSign;
}
public function setDateSign(\DateTimeInterface $dateSign): self
{
$this->dateSign = $dateSign;
return $this;
}
public function getUserValidation(): ?Users
{
return $this->userValidation;
}
public function setUserValidation(?Users $userValidation): self
{
$this->userValidation = $userValidation;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(?int $status): self
{
$this->status = $status;
return $this;
}
public function getDocumentCategory(): ?DocumentCategory
{
return $this->documentCategory;
}
public function setDocumentCategory(?DocumentCategory $documentCategory): self
{
$this->documentCategory = $documentCategory;
return $this;
}
public function getSite(): ?Sites
{
return $this->site;
}
public function setSite(?Sites $site): self
{
$this->site = $site;
return $this;
}
public function getIsDeleted(): ?bool
{
return $this->isDeleted;
}
public function setIsDeleted(?bool $isDeleted): self
{
$this->isDeleted = $isDeleted;
return $this;
}
public function getDateCreate(): ?\DateTimeInterface
{
return $this->dateCreate;
}
public function setDateCreate(?\DateTimeInterface $dateCreate): self
{
$this->dateCreate = $dateCreate;
return $this;
}
public function getDateUpdate(): ?\DateTimeInterface
{
return $this->dateUpdate;
}
public function setDateUpdate(?\DateTimeInterface $dateUpdate): self
{
$this->dateUpdate = $dateUpdate;
return $this;
}
public function getUserUpdate(): ?Users
{
return $this->userUpdate;
}
public function setUserUpdate(?Users $userUpdate): self
{
$this->userUpdate = $userUpdate;
return $this;
}
public function getBeneficiary(): ?Identite
{
return $this->beneficiary;
}
public function setBeneficiary(?Identite $beneficiary): self
{
$this->beneficiary = $beneficiary;
return $this;
}
public function getRequestId(): ?string
{
return $this->requestId;
}
public function setRequestId(?string $requestId): self
{
$this->requestId = $requestId;
return $this;
}
public function getAuthorityName(): ?string
{
return $this->authorityName;
}
public function setAuthorityName(?string $authorityName): self
{
$this->authorityName = $authorityName;
return $this;
}
public function getNumber(): ?string
{
return $this->number;
}
public function setNumber(?string $number): self
{
$this->number = $number;
return $this;
}
/**
* @return Collection|Bills[]
*/
public function getBill(): Collection
{
return $this->bill;
}
public function addBill(Bills $bill): self
{
if (!$this->bill->contains($bill)) {
$this->bill[] = $bill;
$bill->setFolder($this);
}
return $this;
}
public function removeBill(Bills $bill): self
{
if ($this->bill->removeElement($bill)) {
// set the owning side to null (unless already changed)
if ($bill->getFolder() === $this) {
$bill->setFolder(null);
}
}
return $this;
}
/**
* @return Collection|FormValues[]
*/
public function getFormValues(): Collection
{
return $this->formValues;
}
public function addFormValue(FormValues $formValue): self
{
if (!$this->formValues->contains($formValue)) {
$this->formValues[] = $formValue;
$formValue->setFolder($this);
}
return $this;
}
public function removeFormValue(FormValues $formValue): self
{
if ($this->formValues->removeElement($formValue)) {
// set the owning side to null (unless already changed)
if ($formValue->getFolder() === $this) {
$formValue->setFolder(null);
}
}
return $this;
}
/**
* @return Collection|Document[]
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
$document->setFolder($this);
}
return $this;
}
public function removeDocument(Document $document): self
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getFolder() === $this) {
$document->setFolder(null);
}
}
return $this;
}
/**
* @return Collection|RejectedFolder[]
*/
public function getRejectedFolders(): Collection
{
return $this->rejectedFolders;
}
public function addRejectedFolder(RejectedFolder $rejectedFolder): self
{
if (!$this->rejectedFolders->contains($rejectedFolder)) {
$this->rejectedFolders[] = $rejectedFolder;
$rejectedFolder->setFolder($this);
}
return $this;
}
public function removeRejectedFolder(RejectedFolder $rejectedFolder): self
{
if ($this->rejectedFolders->removeElement($rejectedFolder)) {
// set the owning side to null (unless already changed)
if ($rejectedFolder->getFolder() === $this) {
$rejectedFolder->setFolder(null);
}
}
return $this;
}
/**
* @return Collection|ReturnedFolder[]
*/
public function getReturnedFolders(): Collection
{
return $this->returnedFolders;
}
public function addReturnedFolder(ReturnedFolder $returnedFolder): self
{
if (!$this->returnedFolders->contains($returnedFolder)) {
$this->returnedFolders[] = $returnedFolder;
$returnedFolder->setFolder($this);
}
return $this;
}
public function removeReturnedFolder(ReturnedFolder $returnedFolder): self
{
if ($this->returnedFolders->removeElement($returnedFolder)) {
// set the owning side to null (unless already changed)
if ($returnedFolder->getFolder() === $this) {
$returnedFolder->setFolder(null);
}
}
return $this;
}
public function getDateCancellation(): ?\DateTimeInterface
{
return $this->dateCancellation;
}
public function setDateCancellation(?\DateTimeInterface $dateCancellation): self
{
$this->dateCancellation = $dateCancellation;
return $this;
}
public function getUserCancellation(): ?Users
{
return $this->userCancellation;
}
public function setUserCancellation(?Users $userCancellation): self
{
$this->userCancellation = $userCancellation;
return $this;
}
public function getCancellationComment(): ?string
{
return $this->cancellationComment;
}
public function setCancellationComment(?string $cancellationComment): self
{
$this->cancellationComment = $cancellationComment;
return $this;
}
public function getPcode(): ?Pcode
{
return $this->pcode;
}
public function setPcode(?Pcode $pcode): self
{
$this->pcode = $pcode;
return $this;
}
/**
* @return Collection<int, FolderHistory>
*/
public function getFolderHistories(): Collection
{
return $this->folderHistories;
}
public function addFolderHistory(FolderHistory $folderHistory): self
{
if (!$this->folderHistories->contains($folderHistory)) {
$this->folderHistories[] = $folderHistory;
$folderHistory->setFolder($this);
}
return $this;
}
public function removeFolderHistory(FolderHistory $folderHistory): self
{
if ($this->folderHistories->removeElement($folderHistory)) {
// set the owning side to null (unless already changed)
if ($folderHistory->getFolder() === $this) {
$folderHistory->setFolder(null);
}
}
return $this;
}
public function getNumeroQr(): ?string
{
return $this->numeroQr;
}
public function setNumeroQr(?string $numeroQr): self
{
$this->numeroQr = $numeroQr;
return $this;
}
public function isApproved(): ?bool
{
return $this->approved;
}
public function setApproved(bool $approved): self
{
$this->approved = $approved;
return $this;
}
public function getApprovedBy(): ?Users
{
return $this->approvedBy;
}
public function setApprovedBy(?Users $approvedBy): self
{
$this->approvedBy = $approvedBy;
return $this;
}
public function getApprovedAt(): ?\DateTimeImmutable
{
return $this->approvedAt;
}
public function setApprovedAt(?\DateTimeImmutable $approvedAt): self
{
$this->approvedAt = $approvedAt;
return $this;
}
public function isToDeliver(): ?bool
{
return $this->toDeliver;
}
public function setToDeliver(bool $toDeliver): self
{
$this->toDeliver = $toDeliver;
return $this;
}
}