在哪个层应该启动规范模式异常

时间:2017-05-21 17:16:08

标签: php domain-driven-design specification-pattern

我读过应用程序服务或命令处理程序不应该有任何条件。所以,我不知道在哪里我必须提出验证我的规范模式的条件

My code:


    public function handle($request)
    {
        $email = new email($request['email']);

        $emailSpecification = new EmailIsUnique($this->userRepository);

        //this condition where do I have to put it?
        if (!$emailSpecification->isSatisfiedBy($request['email'])) {
            throw new ValueIsNotUniqueException("$request['email'] is already registered");
        }

        ...
    }

0 个答案:

没有答案