Skip to content

Instantly share code, notes, and snippets.

@gabriel403
Last active December 21, 2015 02:59
Show Gist options
  • Save gabriel403/6239340 to your computer and use it in GitHub Desktop.
Save gabriel403/6239340 to your computer and use it in GitHub Desktop.
$data = [];
$data['first_name'] = $this->params()->fromPost('first_name', '');
$data['last_name'] = $this->params()->fromPost('last_name', '');
$form = $this->getUserService()->getUserForm();
$form->setHydrator(new \Zend\Stdlib\Hydrator\ClassMethods);
$form->bind($user);
$form->setData($data);
\Zend\Debug\Debug::dump($form->get('user_auth_email')->getValue());
\Zend\Debug\Debug::dump($form->getInputFilter()->getRawValues());
\Zend\Debug\Debug::dump($form->isValid());
\Zend\Debug\Debug::dump($form->getMessages()); exit;
string(29) "[email protected]"
array(3) {
'first_name' =>
NULL
'last_name' =>
NULL
'user_auth_email' =>
NULL
}
bool(false)
array(1) {
'user_auth_email' =>
array(1) {
'isEmpty' =>
string(36) "Value is required and can't be empty"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment