在mvc中,模型是一个层,它包含所有的域业务逻辑.
在域驱动设计中,业务逻辑可以分为各种构建块.
在域驱动设计域模型中.
A domain model is a system of abstractions that describes selected
aspects of a sphere of knowledge,influence or activity (a domain).
The model can then be used to solve problems related to that domain
开发人员已经阅读了域驱动设计,或正在使用Doctrine2或Hibernate,
通常在DDD中更好地关注域模型.在mvc框架中,模型层与DDD中的域模型重叠.这意味着我们可以在mvc框架中的模型文件夹中实现域模型
这样的实现如下所示.模型文件夹是如何结构的
Model(this can model or domain)
|
|----Entities
| |---BlogPost.PHP
| |---Comment.PHP
| |---User.PHP
|
|----Repositories
| |---BlogPostRepository.PHP
| |---CommentRepository.PHP
| |---UserRepository.PHP
|
|----Services
| |---UserService.PHP
|
|----factories
| |---userfactory.PHP
|
|----dataMappers
| |---userDataMapper.PHP // this inherit from Eloquent model
|
|----ValueObject
>我想知道是我的第一个假设(可以在mvc框架中的模型文件夹中实现域模型)是正确的吗?
>是正确的设计,DDD中的所有构建块在模型文件夹(如上所示)中实现,如实体,服务,存储库
>或有关此实施的任何其他建议.
>如果这是错误的,在mvc框架中实现DDD的构建块(如实体,存储库)的正确方法是什么