ldc-boutique-cnc-sable/domain/Events/AnOrderHasBeenPlaced.php
2026-10-27 09:58:12 +01:00

34 lines
926 B
PHP

<?php
declare(strict_types=1);
namespace Domain\Events;
use Domain\Events\Dto\OrderPlacedShop;
use Domain\Models\ValueObjects\Entities\OrderId;
use Domain\Models\ValueObjects\Matricule;
use Domain\Models\ValueObjects\OrderEmployee;
use Domain\Models\ValueObjects\OrderReference;
use Money\Money;
use Shared\DDD\Event;
final readonly class AnOrderHasBeenPlaced implements Event
{
/**
* @param \Domain\Events\Dto\OrderPlacedLine[] $lines
*/
public function __construct(
public OrderId $orderId,
public OrderReference $reference,
public Money $totalTtc,
public Matricule $byMatricule,
public OrderEmployee $employee,
public OrderPlacedShop $shop,
public \DateTimeImmutable $pickupDay,
public array $lines,
) {
if (empty($lines)) {
throw new \DomainException('An order must have at least one line');
}
}
}