【发布时间】:2012-10-11 12:41:11
【问题描述】:
我正在尝试在下拉列表中创建一个表单。数据来自实体。 问题是我得到了一个“对象”类型的预期参数,“整数”给定异常。
这是我尝试在表单中填充下拉列表的方式:
public function buildForm(FormBuilder $builder, array $options)
{
$builder->add('country', 'entity', array(
'class' => 'SciForumVersion2Bundle:Country',
'property' => 'country',
));
}
在我的实体国家/地区,我有
/**
* @ORM\Column(type="text")
*/
protected $country;
我在表单中编辑的对象是用户对象:
$enquiry = $this->get('security.context')->getToken()->getUser();
在用户实体中,我有
/**
* @ORM\Column(type="integer")
*/
protected $country;
我不知道为什么会出现这个错误。
【问题讨论】: