id = new Id(); $this->affiliate = $affiliate; $this->amount = $amount; $this->status = Status::PENDING; $this->createdAt = new DateTimeImmutable(); } public function getId(): Id { return $this->id; } public function getStatus(): Status { return $this->status; } public function getAmount(): Amount { return $this->amount; } public function getCreatedAt(): DateTimeInterface { return $this->createdAt; } public function getUpdatedAt(): ?DateTimeInterface { return $this->updatedAt; } public function getAffiliate(): AffiliateEntity { return $this->affiliate; } public function approve(): void { if ($this->status == Status::PENDING) { $this->affiliate->approvePayout($this); $this->status = Status::APPROVED; } } public function reject(): void { if ($this->status === Status::PENDING) { $this->affiliate->rejectPayout($this); $this->status = Status::REJECTED; } } #[ORM\PreUpdate] public function preUpdate(): void { $this->updatedAt = new DateTimeImmutable(); } }