Matthew Weier O'Phinney schrieb:
Something along the lines of:

$validatorChain = $dataObject->getValidators();
/* @var $validatorChain Zend_Filter_Input */
$form = new Zend_Form();
$form->setValidators($validatorChain);

Or will I have to recreate all filter rules whenever I want to use Zend_Form? Having two different mechanisms for that would not be an optimal solution (to put it nicely :-)).

Put an issue in the tracker if you'd like to be able to attach
Zend_Filter_Input to Zend_Form; I'm not sure how much effort it would
take, but it may be possible. However... Zend_Form will shortly be
implementing Zend_Validate_Interface, which means you will be able to
use it as your validator chain in your models -- i.e., it *could*
replace Zend_Filter_Input for your models.

Hi Matthew,

thanks for the quick answer :-)

So this would basically mean, I could do something like this?

$form = $dataObject->getForm(); /* @var $form Zend_Form */
$validatorChain = new Zend_Validate();
$validatorChain->addValidator($form);

I don't see how this would help though, as I can only validate single values using Zend_Validate. Even if I use Zend_Filter_Input, I can use a single Zend_Validate object only to validate a single field, not an array of field values.

I must be missing something here?

Seems to me as if I'll have to decide whether I want to use Zend_Form for all incoming data arrays, *or* Zend_Filter_Input.

CU
 Markus

Reply via email to