Using documentation I was trying to use validation class to validate a field submited to $_POST.
use Phalcon\Validation;
use Phalcon\Mvc\Model\Validator\PresenceOf;
[...]
$validation = new Validation();
$validation->add('pageNo', new PresenceOf(array(
'message' => 'Page no is required'
)));
if ($this->request->isPost())
{
$messages = $validation->validate($_POST);
[...]
My $_POST is:
$_POST = array(
'pageNo' => 1,
'recPerPage' => 10
);
During execution I am getting
BadMethodCallException: Wrong number of parameters
on $messages = $validation->validate($_POST);
I cannot find what is wrong here - it seems to me that I am copying the documentation, but I guess I must be missing something....