Wednesday, March 15, 2017

implement DDD in MVC Frameworks - PHP

in mvc the model is a layer and it's contain all the domain business logic.
in domain driven design business logic can be divide into various building blocks like.

in Domain Driven Design domain model is.

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

developer has read Domain Driven Design, or is using Doctrine2 or Hibernate, usually have a better focus on the domain model in DDD.in mvc frameworks model layer is overlap with domain model in DDD.it means we can implement domain model in model folder in mvc frameworks

such a implementations is shown below.shows how model folder is structure

   Model
   | 
   |----Entities
   |    |---BlogPost.php
   |    |---Comment.php
   |    |---User.php
   | 
   |----Repositories
   |    |---BlogPostRepository.php
   |    |---CommentRepository.php
   |    |---UserRepository.php
   | 
   |----Services
   |    |---UserService.php
   | 
   |----factories
   |    |---userfactory.php
   | 
   |----dataMappers
   |    |---userDataMapper.php
   | 
   |----ValueObject


  • i want to know is my first assumption (can implement domain model in model folder in mvc frameworks)is correct ?
  • is it correct design that the all the building blocks in DDD implement in model folder (as shown in above) such as entities,services,repositories
  • or any other suggestions that you have regarding this implementation.
  • if this is wrong what is the correct way of implementing building blocks of DDD such as entities,services,repositories in mvc frameworks


via Susantha7

Advertisement