3 Bounded Contexts (Sales, Invoicing, LegacyFulfillment) avec : - Domaines complets (agrégats, VOs, événements, invariants) - Couche application (commands, queries, ports) - Infrastructure in-memory (repos, gateway fake) - Controllers HTTP Symfony - Couplage naïf synchrone entre BC via NaiveSalesEventPublisher - 20 tests unitaires et d'intégration passants
23 lines
568 B
PHP
23 lines
568 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MiniShop\Sales\Application\Query;
|
|
|
|
use MiniShop\Sales\Application\Port\OrderRepository;
|
|
use MiniShop\Sales\Domain\Model\CustomerId;
|
|
use MiniShop\Sales\Domain\Model\Order;
|
|
|
|
final readonly class ListOrdersByCustomerHandler
|
|
{
|
|
public function __construct(
|
|
private OrderRepository $orderRepository,
|
|
) {}
|
|
|
|
/** @return list<Order> */
|
|
public function __invoke(ListOrdersByCustomer $query): array
|
|
{
|
|
return $this->orderRepository->findByCustomer(CustomerId::fromString($query->customerId));
|
|
}
|
|
}
|