This code gives me white screen with "There is no data to validate" only. $email is not empty. What is wrong???
use Phalcon\Validation;
use Phalcon\Validation\Validator\Email;
class IndexController extends BaseController
{
public function indexAction()
{
if ($this->request->isPost()) {
$email = $this->request->getPost('email');
$validation = new Validation();
$validation->add('email', new Email(array(
'message' => 'The e-mail is not valid'
)));
$messages = $validation->validate($email);
}
}
}