ZF2 Skeleton Application with Doctrine and ctrllib

Building further upon the previous post, I’m gonna follow up with some more integration into ZF2. I’ve been building this class library as a ZF2 module. since it is only a class library, it does not contain any MVC elements. So to be able to work with it I’ve also copied the ZendSkeletonApplication, and added a couple of tools.

  • Composer : dependency management
  • Doctrine 2: ORM Layer (and database managerment via cli)
  • Phing: build scripting and database management
  • DbDeploy: database migration
  • ctrllib: my extensions library for ZF2 and Doctrine 2
  • ctrlAuth: a module based on ctrllib provinding MVC for authentication and authorization
  • Twitter Bootstrap: view helpers and layout

To install the SkeletonApplication just clone the github repo, and fire the ‘composer.phar install’ command.

for more setup options, follow the installation guide in the README file in the repo.
The application provides a default database setup you can manage with phing.

After installation, your application should look like this.

app landing page

ctrlSkeleton

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 »