It’s been a while since my last entry and this is due the dedication of my free time, when not working on client’s projects, to a certain in-house project.
Last week, I’ve quietly launched project chronus. A project which provides multi site administration system geared for collaboration. Project Chronus makes it easy for our website content admin people at DevProducts to keep track of numerous website projects placed under their control.
Project Chronus is the first project I’ve built with Zend Framework 1.8 and above (as in utilising bootstrapping with Zend_Application) that felt natural. I’ve built several projects with Zend framework 1.5+, but not as comfortably as I did with my recent project.
While Project Chronus is a project to be used for our own internal purposes, it served as a live project with enough real requirements to be effectively used as a sandbox for future projects we choose to undertake and in addition, set (and put to the test) standards for how we do things.
What I used to build Project Chronus:
- Zend Framework 1.10+
- I used the Recommended Project Directory Structure.
- Zend_Authand a Controller Plugin to check for/redirect authenticated/non-authenticated users.
- ZendX_Doctrine_Auth_Adapter – although we had to change Doctrine to Doctrine_Core on line 168 since we are using Doctrine 1.2.x which does not have the empty Doctrine class extending Doctrine_Core.
- Zend_Dojo_Form
- Dojo View helpers
- TabContainer
- ContentContainer
- We also _slapped_ together an EnhancedDataGrid View helper class (using EnhancedGrid in Dojo 1.4) – which supports menus, delete, export and added a togglable search form.This class is in dire need of refactoring, but it does the job – and doing it well so far. I’m waiting to see if Matthew’s proposal gets active and becomes complete, to see how the ZF/Dojo pros do it and will then fashion our and perhaps release some code I would not be ashamed of.
- Zend_Navigation
- Zend_View_Helper_Placeholder
- Zend_Test_PHPUnit_ControllerTestCase – Yes, we were unit testing everything including Controllers and Views! Although sadly, we found ourselves reverting to “just code it now” conventions as we raced tot the finish line.So we stopped testing Controllers and Views midway – we did however, unit test most of our model_service code and it’s in the cards to write tests for the untested units to achieve 100% code coverage for controllers and models.
- Dojo 1.4x
- Several form Dijits.
- The EnhancedGrid component.
- Menus Plugin
- Dojo.xhrGet/Post
- TabContainer
- ContentPane
- Doctrine 1.2.x ORM
- Doctrine Query Language – We use DQL extensively within our Service classes to fetch and use models.
- SFYAML – Doctrine uses this to process fixtures and schema yml files which we use to setup and update the database schema.
- PHPUnit 3..4.11
Approaches we used to build the Project:
- Service Layer – as per my previous entry: “My Zend Framework Model Layer: Part Service, Part ORM” with a few tweaks included. I didn’t get a chance to include ACL into the Service Classes however. I went with the Controller Plugin option, because we did not have a requirement for multi-role user system.I was a little confused at certain times. For instance, I have a Service Layer for authentication and password which started off as authentication, change password and reset password. Still throwing it around, but aside from this, when I have to deal with actual entities, the Service Layer class is pretty much semantic.
- Authentication Module – Another thing that was slightly strange was that I decided to create a separate authentication module where I put in my login, logout, reset password confirmation (sends email) and reset password (after confirmation) features. With this being in a module, I can just drop this module in whenever these generic features are required.
I will be using this as a base for any web applications we will be building using the Zend Framework. The generic features in Authentication and other unmentioned features such as an administrator dashboard module which has features for managing System Users serve as a great starting point for any web application.
I guess it goes without saying, I’m lovin’ web dev at the moment and I’ve finally got some free time, so it’s back to blogging.


Hi, thanks for your excellent posts on Zend/Doctrine. I’ve been agonizing over similar MVC issues, and was wondering if you would be willing to share your source code for Chronus?
Hi Michael,
Project Chronus is something that was developed for in-house purposes and sadly, since I am not the only one involved, I cannot release the source code.
I do however have a project that I am currently working on that is free and will build upon a standard ZF release, integrated with Doctrine. It’s kind of stalled at the moment though what with life, freelancing and everything in between.
I’ll be happy to answer any questions you have regarding the issues you’ve been agonising over though.
Currently, my issues are rooted in a clean setup of a ZF/Doctrine 2.0 application. Any advice on setting up data fixtures, unit test, and a build script? How do you handle pushing database revisions to a production environment?
Thank you for your response.
To follow up, I just found out that Doctrine has a migrations class I can use, to handle database revisions across releases. I started to work on a build script and data fixtures setup, and I think I’m making progress on this. What I am currently struggling with is the service layer. Would you recommending have a service for every model? Do yo u have services that don’t necessarily correspond to a model (i.e. AuthenticationService)?
Hi Michael, _extremely_ late in response, but how I see it is this. The service is part of the model layer. The service becomes the gateway for communication between the Controller and the underlying model or models it uses to provide a service.
> Would you recommending have a service for every model?
> Do yo u have services that don’t necessarily correspond to a model (i.e. AuthenticationService)?
Do what’s sane. Don’t blindly create a service for every model that’s there, this is a sure fire way to redundant code that will just get in the way later on.
Regarding your example, Authentication Service and ACL in model layers in general (as per your email), if you haven’t already, check out how Matt fleshes it out here http://weierophinney.net/matthew/archives/201-Applying-ACLs-to-Models.html
PS: Sorry I didn’t get to answer your email, I got flooded with work the second I received it; hopefully, by the time you read this you have found your answers and maybe you could teach me a thing or two regarding integrating ACL into the model layer.