Sunday, March 22, 2015

CakePHP 3.X - Creating Reusable Validators

Hi everyone,

I'm studying CakePHP 3.x.

I have a form with three fields to change the password:
  • OLD Password
  • NEW Password
  • Confirmation NEW Password

I would like to implement a validation for the Old Password.

To do this I think it is necessary to create a custom Validators that interacts with the ORM.


The code on the manual suggests doing so:

Creating Reusable Validators

example:

// In src/Model/Validation/ContactValidator.php  namespace App\Model\Validation;    use Cake\Validation\Validator;    class ContactValidator extends Validator  {      public function __construct()      {          parent::__construct();          // Add validation rules here.      }  }
Is this the procedure to follow?


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: