Checking Doctrine and Zend_Form

I use Zend Framework and Doctrine in a project, and I was wondering if anyone could suggest a good way to integrate Doctrine validation with Zend_Form. I am trying to avoid code duplication.

+7
php validation zend-framework doctrine
source share
1 answer

If you are happy with error aggregation for your form, you can do it as follows: - Make Zend_Form without validators - In the view, make a Doctrine object and call isValid () - If they are invalid, do not save, but show the error form again

However, I would recommend you either - Write both validators for your Zend_Form and your model. - Write validators for your Zend_Form that take the model and the Doctrine field as input, and then check the material against your model.

I believe the latter option can be a very general library, useful for even inclusion in the Zend Framework. However, it is tiring to write it in the right way.

+1
source share

All Articles