Created
January 18, 2015 10:05
-
-
Save Doopin/f6fc72c5ac8fdc3243fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$inputFilter->add($factory->createInput(array( | |
array( | |
'name' => 'birthday', | |
'validators' => array( | |
array( | |
'name' => 'Zend\Validator\Date', | |
'break_chain_on_failure' => true, | |
) | |
), | |
'filters' => array( | |
array( | |
'name' => 'Callback', | |
'options' => array( | |
'callback' => function ($date) { | |
// Convert the date to database format, as allowed by the Validator\Date | |
if (!is_array($date) || empty($date['year']) || empty($date['month']) || empty($date['day'])) { | |
return null; | |
} | |
return $date['year'].'-'.$date['month'].'-'.$date['day']; | |
} | |
) | |
) | |
) | |
) | |
))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment