Hackathon – Zend Framework 2 with Doctrine 2

It has been sometime since I got the chance to just get into some new code and try out some new tools. New year’s day (and part of then next) was spent trying out Zend Framework 2 beta 2 and Doctrine 2 in a little play project. The project was pretty simple, take a basic ZF2 application (based on Rob Allen’s ZF2 tutorial) and use Doctrine2 for the database calls instead of Zend’s native database tools. I’ve put the finished project up on Github here (my first gihub repo).

Thoughts on Zend Framework 2

For the last few months I have been doing a lot of reading and watching of Zend Casts tutorial videos in an effort to learn and research the ins and outs of the Zend Framework. So far I’ve focused on version 1.x of the framework but in my travels during the xmas holidays I was introduced to some of the new features version 2 will have while listening to a podcast. The differences seemed huge. In particular Version 2 introduces a whole new MVC layer that makes modules a lot more user friendly. In fact, now modules are easily copied between different applications in the same way plugins are in JojoCMS, while still keeping their own MVC structure.

And Doctrine 2

As part of research for a project starting soon, I spent quite of time researching database alternatives and found that using Doctrine on top of MySQL would give me the object orientated approach I was looking for while using a database technology I knew well. In ZF1 integrating Doctrine2 could be a little tricky but with the new module approach of ZF2 and the fact that some people had already built some great Doctrine modules it looked like a great option.

The results

The best part about this hackathon was the fact that when it came to using the doctrine modules, I decided on the using the SpiffyDoctrine and SpiffyDoctrineORM, there was next to no documentation so putting everything together really relied on applying information from related sources and applying it to this. As a result I learnt a heap about ZF2, a heap about Doctrine2 and a heap about PHP 5.3, in particular the new namespaces stuff. The added bonus is that I have another set of tools for the toolbox for building killer web apps.