【发布时间】:2016-02-26 08:23:20
【问题描述】:
我正在使用 DDD 构建电子商务系统。在这个系统中,我有两个有界上下文:Identity & Access 和 Sales。
客户可以通过填写姓名、电子邮件和密码的表格进行注册。然后在Sales 上下文中,我注册了一个客户:
$customer = new Customer($request->name, $request->email);
$this->customers->add($customer);
Customer 聚合引发 CustomerWasRegistered 事件。
Identity & Access 上下文对此事件作出反应并为该客户创建一个 SystemUser 聚合:
$user = new SystemUser($email, $password);
$this->users->add($user);
我的问题:因为Customer 聚合不知道密码(CustomerWasRegistered 事件也不知道)。如何从请求中获取此密码到 Identity & Access 上下文?
【问题讨论】:
标签: php domain-driven-design domain-events