I am working on a Zend application, but I donβt have much experience with Zend, so I simply rely on my RubyOnRails experience.
From the articles in pairs, I found that most of the validation is done at the Forms level - with Zend_Form. But for me it looks a little strange - how about checking at the model level - create a model based on the form data, and run smth, like $model->isValid(); this makes sense as I create some models without post post requests. p>
My current model stream:
ProductMapper extends Zend_Db_Table Product extends Zend_Db_Table_Row
And given that I'm doing something like
$mapper = new ProductMapper(); $product => $mapper->find(...); // Do some staff with this model // And want to check if it valid before saving if ($product.isValid()) { $product.save(); // Zend_Db_Table_Row method } else { ... }
I understand that I can just check with RegExp inside the isValid method, but I would like to use already implemented methods from Zend_Form , for example addValidator , addFilter and all that is useful.
Is this also the right way to manage models in Zend?
Any help or suggestions would be greatly appreciated!
source share