ModelForm developments

Tags:

I’ve been reworking the ModelForm class for ZF a bit. Earlier this year, I discussed porting it to use Zend_Db_Table with Matthew Weier O’Phinney, for using it with Zend Framework. I initially had done some checking on Zend_Db_Table, and some small code changes to modify the class to use it instead of Doctrine, but I ran into some issues. Now, I’ve had some time to think about it, I’ve reworked the class slightly and added basic Zend_Db_Table support, too…

Read More

Another idea for using models with forms

Tags:

Matthew Weier O’Phinney wrote about using Zend_Form with models. His approach puts a form inside a model, which then uses the form to validate itself.

While this idea is not bad, I find it being upside down – I think the form should use the model to validate itself, not the other way around.

But how would you utilize a model class to validate a form? I think there are two feasible ways to do so: A global model for a form, and a model-based validator class…

Read More

The problems faced by a common model interface in frameworks

Tags:

You sometimes see people asking why the Zend Framework (or some others) don’t provide a library for the Model part in MVC.

While ZF provides data access classes in the form of Zend_Db and related components, it doesn’t provide any concrete examples of how you would implement a model class. This often confuses especially beginners.

Providing a common base model, or an interface for implementing models, does have certain benefits, but it also has some problems…

Read More

Autogenerating forms from Doctrine models

Tags:

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 I was already quite familiar with Doctrine’s internals, I knew it would be possible to find out all the data on the models quite easily, and set upon creating a class which generates Zend Framework’s Zend_Form based form classes from Doctrine models…

Edit 10.10.2008: Updated the post to reflect some minor changes in the CU_ModelForm class

Read More

Django = Awesome

Tags:

So in the lack of anything “useful” to post, and in the attemps to at least post something interesting, I shall dedicate this post to talking about what makes Django such an awesome framework!

I’m going to compare it to Zend Framework, as it’s the framework I’m most familiar with.

Read More