Domain layer and ZendFramework2 using Zend\ServiceManager

UPDATE: ctrllib has been implemented in CtrlSkeleton, providing easy database management for Doctrine entities and implemented ViewHelpers for Twitter Bootstrap.

In the previous article I gave a brief overview of how the current implementation of my Domain Layer looks. To be able to use these classes inside ZF2 controllers I used a custom ServiceManager Factory. This custom ServiceManager will take care of Dependency Injection and register configured DomainServices

Continue reading »

Domain Layer with Doctrine2

UPDATE: ctrllib has been implemented in CtrlSkeleton, providing easy database management for Doctrine entities and implemented ViewHelpers for Twitter Bootstrap.

In a previous post I explained briefly why you need a Service Layer, since then a lot of things have changed, so here’s an update of how I handle things at the moment.

For starters I’m going to stop calling it a service layer and use the term Domain Layer, which is more adequate:

  • my implementation provides a base DomainModel and provides additional domain model related classes (e.g.: Form)
  • concerning service classes are related to the domain model
  • ZF2 adds its own ServiceManager so in the ZF2 world, a Service is something much broader

I’ve been working on a new implementation which can be found on my github: ctrl-f5/ctrllib. please check the github repo for a complete and up-to-date implementation.

This article gives a brief overview of how the base Domain related classes look, integration in ZF2 will follow.

Continue reading »