Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Domain-driven design with Zend

This question is a continuation of my previous question here zend models architecture (big thanks to Bill Karwin). I've made some reading including this article

  • http://weierophinney.net/matthew/archives/202-Model-Infrastructure.html

and this question

  • How To Properly Create Domain using Zend Framework?

Now I understand, what domain driven design is. But examples are still very simple and poor. They are based on one table and one model. Now, my question is: do they use Domain Model Design in real-world PHP projects?

I've been looking for some good documentation about this, but I haven't found anything good enough, that explains how to manage several tables and transfer them to Domain Objects. As long as I know, there is Hibernate library, that has this features in Java, but what should I use in PHP (Zend Framework)?

like image 447
mik Avatar asked Apr 06 '10 05:04

mik


2 Answers

There is a newsgroup formed by Matthias Verraes about doing DDD in PHP, mainly with Sf2.

Somewhat older is a series of articles by Federico Cargnelutti on how to do DDD with PHP and in parts with ZF that might be of interest to you:

  • Domain-Driven Design and MVC Architectures
  • Domain-Driven Design: Data Access Strategies
  • Domain-Driven Design: The Repository
  • Domain-Driven Design: Sample Application

Regarding ZF, there has been a proposal for Zend_Entity and Zend_DataMapper for some time, but development on those has been terminated in favor of integrating ZF with Doctrine. Doctrine is also the closest thing to Hibernate in PHP.

When googling for DDD with PHP, there will be a few additional resources, but nothing as comprehensive as the resources available at the official DDD site with code for the App described in Eric Evan's DDD book.

like image 196
Gordon Avatar answered Oct 05 '22 23:10

Gordon


Have a look at my project at GitHub. It tried to follow the principles of DDD, SOLID and OOP. PHP and DDD. There is no ORM inside but a hand-made Data Access Layer. Domain entities exchange messages. Presentation Layer gets a special kind of objects. You will find a lot of factories. They are intended to simplify unit testing and maintenace. I hope some techniques can be of interest for you.

like image 38
Alexander Novikov Avatar answered Oct 05 '22 22:10

Alexander Novikov