27 lines
625 B
PHP
27 lines
625 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace Domain\Events\Dto;
|
||
|
|
|
||
|
|
use Domain\Enums\Units\OrderUnit;
|
||
|
|
use Domain\Models\ValueObjects\IncoId;
|
||
|
|
use Money\Money;
|
||
|
|
|
||
|
|
final readonly class OrderPlacedLine
|
||
|
|
{
|
||
|
|
public function __construct(
|
||
|
|
public string $productName,
|
||
|
|
public IncoId $productIncoId,
|
||
|
|
public bool $productWeightIsVariable,
|
||
|
|
public ?Money $productPriceKgTtc,
|
||
|
|
public OrderUnit $productOrderUnit,
|
||
|
|
public int $quantity,
|
||
|
|
public Money $totalTtc,
|
||
|
|
) {
|
||
|
|
if ($quantity <= 0) {
|
||
|
|
throw new \DomainException('Quantity must be greater than 0');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|