in my entity i have set this
public function setExpiry(\DateTime $expiry = null)
{
$this->expiry = $expiry;
}
in formType i have set this
$builder->add('expiry', 'choice', array(
'choices' => array(
date ("Y-m-d H:i:s",mktime(date('H'),date('i'),date('s'),date('m'),date('d')
+3,date('Y'))) => '3 days',
));
but when submit, return this error
::setExpiry() must be an instance of DateTime, string given,
i have understand that “string given” but how i can convert in
datatime object?
How about something like this: