Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 31 lines (27 sloc) 0.737 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
<?php
/**
* CustomValidationModel
*
* It uses core "notEmpty" validation.
*
* a custom validation "CustomValidationObject::myCustomRule" loaded
* from /Model/Validation/CustomValidationObject
*
* and a non-existing validation from "NonExistingObject::nonExistingMethod".
* this rule will trigger a notice
*/
class CustomValidationModel extends AppModel {

public $useTable = false;

public $validate = array(
'name' => 'notEmpty',
'surname' => array(
'rule' => 'CustomValidationObject::myCustomRule',
'message' => 'value not accepted'
),
'age' => 'NonExistingObject::nonExistingMethod',
'odd_number' => array(
'rule' => 'CustomValidationObject::odd',
'message' => 'Please insert odd number'
)
);

}
Something went wrong with that request. Please try again.