Skip to content

Instantly share code, notes, and snippets.

@dmregister
Created April 7, 2015 16:13
Show Gist options
  • Save dmregister/10ae30ac8419b5596b1d to your computer and use it in GitHub Desktop.
Save dmregister/10ae30ac8419b5596b1d to your computer and use it in GitHub Desktop.
email validator
$this->add(array(
'name' => 'email',
'required' => true,
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array(
'messages' => array(
\Zend\Validator\NotEmpty::IS_EMPTY => 'Email cannot be empty'
),
),
),
array(
'name' => 'DoctrineModule\Validator\NoObjectExists',
'options' => array(
'object_repository' => $userRepository,
'fields' => array('email'),
'messages' => array(
'objectFound' => 'An account with this email already exists.'
)
)
)
)
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment