uuid = Uuid::v4(); $this->status = static::STATUS_NEW; $this->assignment = $application->getAssignment(); $this->teamer = $application->getTeamer(); $this->pickup = $application->getPickup(); $this->specialAgreements = $application->getRequests(); $this->documents = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getUuid(): string { return $this->uuid; } public function getStatus(): ?string { return $this->status; } public function setStatus(string $status): static { $this->status = $status; return $this; } public function getAssignment(): ?Assignment { return $this->assignment; } public function setAssignment(?Assignment $assignment): static { $this->assignment = $assignment; return $this; } public function getTeamer(): ?Teamer { return $this->teamer; } public function setTeamer(?Teamer $teamer): static { $this->teamer = $teamer; return $this; } public function getPickup(): ?int { return $this->pickup; } public function setPickup(?int $pickup): static { $this->pickup = $pickup; return $this; } public function getRemarks(): ?string { return $this->remarks; } public function setRemarks(?string $remarks): static { $this->remarks = $remarks; return $this; } public function getSpecialAgreements(): ?string { return $this->specialAgreements; } public function setSpecialAgreements(?string $specialAgreements): static { $this->specialAgreements = $specialAgreements; return $this; } /** * @return Collection */ public function getDocuments(): Collection { return $this->documents; } public function getDocumentByType(string $type): ?Upload { foreach ($this->getDocuments() as $upload) { if ($type === $upload->getType()) { return $upload; } } return null; } public function addDocument(Upload $document): static { if (!$this->documents->contains($document)) { $this->documents->add($document); $document->setDisposition($this); } return $this; } public function removeDocument(Upload $document): static { if ($this->documents->removeElement($document)) { // set the owning side to null (unless already changed) if ($document->getDisposition() === $this) { $document->setDisposition(null); } } return $this; } public function getFeedback(): ?Feedback { return $this->feedback; } public function setFeedback(?Feedback $feedback): static { $this->feedback = $feedback; return $this; } public function isContractDue(): bool { if (null !== $this->getDocumentByType(Upload::TYPE_CONTRACT)) { return false; } $assignment = $this->getAssignment(); $assignmentPeriod = $assignment->getEffectivePeriod(); $dueDateFrom = $this->getCreatedAt()->modify('+7 days'); $dueDateTo = $assignmentPeriod->end->modify('-1 day'); $period = CarbonPeriod::create($dueDateFrom, $dueDateTo); return $period->isStarted(); } public function isContractRejected(): bool { if (null === $contractDocument = $this->getDocumentByType(Upload::TYPE_CONTRACT)) { return false; } return $contractDocument->isRejected(); } public function isInvoiceDue(): bool { if (null !== $this->getDocumentByType(Upload::TYPE_INVOICE)) { return false; } $assignment = $this->getAssignment(); $assignmentPeriod = $assignment->getEffectivePeriod(); $period = CarbonPeriod::create($assignmentPeriod->getEndDate(), $assignmentPeriod->getEndDate()->modify('+14 days')); return $period->isStarted(); } public function getCalledOffBy(): ?string { return $this->calledOffBy; } public function setCalledOffBy(?string $calledOffBy): static { $this->calledOffBy = $calledOffBy; return $this; } public function getCalledOffReason(): ?string { return $this->calledOffReason; } public function setCalledOffReason(?string $calledOffReason): static { $this->calledOffReason = $calledOffReason; return $this; } }