-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrder.php
More file actions
42 lines (36 loc) · 1.25 KB
/
Order.php
File metadata and controls
42 lines (36 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
declare(strict_types=1);
namespace Example\Order;
use Example\Order\ValueObjects\DeliveryDateTime;
use Example\Order\ValueObjects\DeliveryEmployeeFullName;
use Example\Order\ValueObjects\OrderId;
use Example\Order\ValueObjects\PaymentAmount;
use Example\Order\ValueObjects\RecipientFullName;
use Example\Order\ValueObjects\Status;
/**
* This is the domain model groping value objects.
*/
final class Order
{
protected $value;
public function __construct(
readonly private OrderId $id,
readonly private RecipientFullName $recipientFullName,
readonly private Status $status,
readonly private PaymentAmount $paymentAmount,
readonly private DeliveryDateTime $deliveryDateTime,
readonly private DeliveryEmployeeFullName $deliveryEmployeeFullName
) {
}
public function toArray(): array
{
return [
'id' => $this->id->value(),
'recipient_full_name' => $this->recipientFullName->value(),
'status' => $this->status->value(),
'payment_amount' => $this->paymentAmount->value(),
'delivery_date_time' => $this->deliveryDateTime->value(),
'delivery_employee_full_name' => $this->deliveryEmployeeFullName->value(),
];
}
}