1
我使用jms序列化程序包来序列化我们工作api中的表单错误。 从用户注册API,我们有一个形式,这种方式构建的:Symfony 2.2:更改序列化表单字段名称
/**
* Creates the form fields
*
* @param FormBuilderInterface $builder The form builder
* @param array $options The array of passed options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('plainPassword', 'password', array('label' => 'asdasd'))
->add('name', 'text')
->add('email', 'email');
}
,并提交错误信息,我们得到:
"children": {
"plainPassword": {
"errors": [
"This value should not be blank."
]
}
}
由于实体领域是plainPassword可能有它命名为密码和分配到plainPassword字段?