0
我已经将这个Symfony2的表格日期时间返回错误
public function setExpiry(\DateTime $expiry = null)
{
$this->expiry = $expiry;
}
在formType
我已经将这个
$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',
));
但提交时,返回此错误
::setExpiry() must be an instance of DateTime, string given,
我有明白,“字符串给定”,但我怎么能在 datatime对象转换?