【发布时间】:2020-02-20 12:39:28
【问题描述】:
在服务请求中处理可选参数的正确方法是什么?
假设在这种情况下,我还想将$title 作为可选参数
<?php
namespace Lw\Application\Service\Wish;
class AddWishRequest
{
private $userId;
private $email;
private $content;
public function __construct($userId, $email, $content)
{
$this->userId = $userId;
$this->email = $email;
$this->content = $content;
}
public function userId()
{
return $this->userId;
}
public function email()
{
return $this->email;
}
public function content()
{
return $this->content;
}
}
来自here的示例
【问题讨论】:
-
请考虑帮助您标记为正确的答案。
-
当然,我需要先花点时间。
标签: php domain-driven-design cqrs