diff --git a/src/Model/Complaint/Complaint.php b/src/Model/Complaint/Complaint.php index 528a68b5b3..5bb55966b4 100644 --- a/src/Model/Complaint/Complaint.php +++ b/src/Model/Complaint/Complaint.php @@ -141,7 +141,12 @@ class Complaint */ public function __construct(ComplaintData $complaintData, array $complaintItems) { - $this->createdAt = new DateTime(); + if ($complaintData->createdAt === null) { + $this->createdAt = new DateTime(); + } else { + $this->createdAt = $complaintData->createdAt; + } + $this->uuid = $complaintData->uuid ?? Uuid::uuid4()->toString(); $this->number = $complaintData->number; $this->domainId = $complaintData->domainId; diff --git a/src/Model/Complaint/ComplaintData.php b/src/Model/Complaint/ComplaintData.php index 3b9dc33fa2..64004333de 100644 --- a/src/Model/Complaint/ComplaintData.php +++ b/src/Model/Complaint/ComplaintData.php @@ -21,6 +21,11 @@ class ComplaintData */ public $number; + /** + * @var \DateTime|null + */ + public $createdAt; + /** * @var \Shopsys\FrameworkBundle\Model\Order\Order|null */