0
在我的实体,我有一个领域,如:Symfony2的表单验证
/**
* @var decimal $Size
*
* @ORM\Column(name="Size", type="decimal", scale="2")
* @Assert\NotBlank()
* @Assert\Type(type="numeric")
*/
private $Size;
但是当我输入一个字符串,如在创作形式的“富”,功能bindRequest抛出:
Expected argument of type "numeric", "boolean" given
500 Internal Server Error - UnexpectedTypeException
控制器代码是:
$request = $this->get('request');
if ($request->getMethod() == 'POST')
{
$form->bindRequest($request);
if ($form->isValid())
{
$em = $this->getDoctrine()->getEntityManager();
$em->persist($support);
$em->flush();
return $this->redirect($this->generateUrl('mediatheque_support_' . $shortcut . '_list'));
}
}
任何想法?
谢谢
你确定其他没有错误吗?我尝试了相同的代码,它的工作原理没问题。你不是在其他地方操作POST数据吗? –