MongoDB Base Model for Zend Framework

I came accross [MongoDB][1] a few months ago and it seemed like a perfect fit for many of the projects I am working. Extremely fast inserts, map-reduce for complex queries, and most importantly, scaling is a breeze.

Since I am a Zend Framework guy I created a simple base model class for MongoDB. It is a very simple wrapper, but is effective for what I need. I usually create model classes for each “Collection” just like I would create models for each table in MySQL. Each model class extends from the new MongoDB base class and allows a low level “active directory” type access to MongoDB documents.

Zend Framework Code Generator With Scaffolding: ZFcodo

Update: This project is now hosted at my [GitHub account][1].

While I am a huge fan of Zend Framework, I miss having the code generation that is bundled with other frameworks I use. Since my favorite codegen/ORM is from the Qcubed project, I decided to take the Qcubed code generator and customize it for Zend Framework.

Custom Error Messages on Zend Form Validators

Zend Form is extremely powerful, and I love most of the built in validators. But some of the validators are overkill for many projects. Take the EmailAddress validator for instance. I have never worked on a web-form where I wanted 3 error messages to appear if the Email address entered was invalid. (To see what I mean, just type in “[email protected]” for your email address and see what Zend_Validate_EmailAddress displays). I have seen several questions and complaints about this problem ([Example 1][1] or [Example 2][2]) and thought I would offer up my fix.