显示名称但插入id whit实体字段类型 [英] display the name but insert the id whit entity field type
本文介绍了显示名称但插入id whit实体字段类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Symfony 2.3
Symfony 2.3
$builder->add('users', 'entity', array(
'class' => 'AcmeHelloBundle:User',
'property' => 'name',
));
使用此方法在更新表单中显示选定用户。问题是,当发送数据时,发送名称并想要在选择中显示名称时发送id。
不使用数据库中的关系或实体
Use this method to display a select users in a update form. The problem is that when the data are sent , send the name and want to send the id while showing the names in the select.
not use relationships in the database or the entities
推荐答案
builder-> add(' 用户,' entity',array(
' class' => ' AcmeHelloBundle:用户',
' property' => ; ' name',
));
builder->add('users', 'entity', array( 'class' => 'AcmeHelloBundle:User', 'property' => 'name', ));
使用此方法在更新表单中显示选定用户。问题是,当发送数据时,发送名称并想要在选择中显示名称时发送id。
不使用数据库中的关系或实体
Use this method to display a select users in a update form. The problem is that when the data are sent , send the name and want to send the id while showing the names in the select.
not use relationships in the database or the entities
这篇关于显示名称但插入id whit实体字段类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文