-
-
Save dgafka/15493c408991be810b63be601a792a2b to your computer and use it in GitHub Desktop.
outbox-pattern-01.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
final class OrderService | |
{ | |
#[CommandHandler] | |
public static function placeOrder(PlaceOrder $command, OrderRepository $orderRepository, EventBus $eventBus): self | |
{ | |
$order = new Order($command->getOrderId(), $command->getProductName()); | |
$orderRepository->save($order); | |
$eventBus->publish(new OrderWasPlaced($command->getOrderId(), $command->getProductName())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment