extends abstract class Phalcon\Validation\Validator
implements Phalcon\Validation\ValidatorInterface
Calls user function for validation
use Phalcon\Validation\Validator\Callback as CallbackValidator; use Phalcon\Validation\Validator\Numericality as NumericalityValidator; $validator->add( ["user", "admin"], new CallbackValidator( [ "message" => "There must be only an user or admin set", "callback" => function($data) { if (!empty($data->getUser()) && !empty($data->getAdmin())) { return false; } return true; } ] ) ); $validator->add( "amount", new CallbackValidator( [ "callback" => function($data) { if (!empty($data->getProduct())) { return new NumericalityValidator( [ "message" => "Amount must be a number." ] ); } } ] ) );
Executes the validation
Phalcon\Validation\Validator constructor
Checks if an option has been defined
Checks if an option is defined
Returns an option in the validator’s options Returns null if the option hasn’t set
Sets an option in the validator
© 2011–2017 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Validation_Validator_Callback.html