Performing authentication in custom validator in ZF

February 21, 2011 Zend Framework

Although, this is not a good approach to use more than one value in Zend_Validate, but it may be useful sometimes if you want to write your custom validator and add it to let’s say password field and use it as other validators in Zend_Form. So

we added it to password field. Now let’s have a look at its implementation:

We assume that username and password columns are in users table (see https://framework.zend.com/manual/en/zend.auth.adapter.dbtable.html) Pay attention to this

and

context = null second parameter. It holds all form values. So there we get username field.


Leave a Reply

Your email address will not be published