Aggregate Introduction
DDD Aggregates PHP
Aggregate Command Handlers
$product = $this->repository->getById($command->id());
$product->changePrice($command->getPriceAmount());
$this->repository->save($product); #[Aggregate]
class Product
{
#[Identifier]
private string $productId;class ChangePriceCommand
{
private string $productId; // same property name as Aggregate's Identifier
private Money $priceAmount;State-Stored Aggregate
Last updated
Was this helpful?