Decoupling models from the database: Data Access Object pattern in PHP

Monday, January 5th, 2009

Nowadays it's a quite common approach to have models that essentially just represent database tables, and may support saving the model instance right to the database. While the ActiveRecord pattern and things like Doctrine are useful, you may sometimes want to decouple the actual storage mechanism from the rest of ...

Programming language guessing game

Tuesday, December 9th, 2008

Some of you asked me about the "quiz" thing that showed up in one of the screenshots in my NetBeans review... Well, here it is: During that weekend when I was trying out NetBeans, I wrote a small Zend Framework + Doctrine application which attempts to guess a programming language ...

Understanding Doctrine’s NestedSet feature

Saturday, August 30th, 2008

The Doctrine library comes with a feature called nested set, which makes saving trees in a database easy. However, it's quite easy to accidentally cause a lot of extra unneeded queries if not being careful. Here are some pointers to keep in mind while working with the nested set, and some ...

Zend_Form’s from Doctrine models: Part 2

Wednesday, June 4th, 2008

Previously I wrote about my class for generating Zend_Form forms from Doctrine models. This time, let's look at some more usage examples and how it works internally, to make it easier for you to utilize it. Edit 10.10.2008: Updated the post to reflect some minor changes in the CU_ModelForm class

Autogenerating forms from Doctrine models

Monday, June 2nd, 2008

In a previous post I mentioned how Django's model forms are awesome. I really like the idea of being able to generate forms automatically from models - I mean the models already should contain most of the data you'd need: the fields, field types and how they will be stored. Since ...