Hello,
I've been trying to convert localized date values (dd.MM.yyyy) gathered by
my form, to a format I can use in MySQL diabase (yyyy-MM-dd). I have been
able to extract my date parts successfuly, although that's not so much
success for me: the LocalizedToNormalized filter populates the form value
with an array, not a string. So I have following:
array(3) {
["show_since"] => array(5) {
["date_format"] => string(8) "d.M.yyyy"
["locale"] => string(2) "cs"
["day"] => string(1) "2"
["month"] => string(1) "2"
["year"] => string(4) "2010"
}
}
My intention is to pass the array returned by Zend_Form::getValues()
directly to the Zend_Db_Table::insert(), which is blocked by the fact, that
I have an array in the "show_since" field.
Is there a way, how to automate following scenario by default code?
1. User inputs localized date
2. User submits the form
3. Form is being validated, $data = $form->getValues() is called
4. $data variable is an array with one field named "show since",
containing a value in yyyy-MM-dd format
I have no trouble to write my own workaround, but I think this is very
common thing, so there should be a smart(er) way to do it
PS: yeah, this could be resolved by manual conversion in my mapper, but the
question remains: Is ZF capable of doing such conversion by itself?
Thanks all.
Jan