Aggregate Command Handlers
DDD PHP
Aggregate Factory Method
#[Aggregate]
class Ticket
{
#[Identifier]
private Uuid $ticketId;
private string $description;
private string $assignedTo;
#[CommandHandler]
public static function createTicket(CreateTicket $command): static
{
$ticket = new self();
$ticket->id = Uuid::generate();
$ticket->assignedTo = $command->assignedTo;
$ticket->description = $command->description;
return $ticket;
}
}Aggregate Action Method
Calling Aggregate without Command Class
Redirected Aggregate Creation
Publishing Events from Aggregate
Calling Aggregate with additional arguments
Last updated
Was this helpful?