在 Symfony 中嵌入表单 [英] Embed forms in Symfony
问题描述
我已经向 sfDoctrineGuard 添加了一个配置文件类,并且在管理员中,我尝试在编辑用户的同时编辑配置文件部分,使用如下所述的嵌入表单:
I've added a profile class to sfDoctrineGuard, and in the admin I'm trying to edit the profile part while editing the user, using embed forms as explained here:
http://www.symfony-project.org/blog/2008/11/12/call-the-expert-customizing-sfdoctrineguardplugin
编辑用户有效,但当我添加
Editing users works, but when I add
用户":[用户名,密码,password_again,个人资料]
"User": [username, password, password_again, Profile]
我得到的只是一条错误消息:
All I get is an error message :
小部件配置文件"不存在.
Widget "Profile" does not exist.
任何帮助将不胜感激.博文过时了吗?
Any help would be appreciated. Is the blog post out of date ?
推荐答案
现在有一种很好的简洁方法可以做到这一点....您使用的是 1.3 还是 1.4?
There's a nice neat way to do this now.... Are you using 1.3 or 1.4?
在用户表单中:
public function configure()
{
$this->embedRelation('Profile');
}
假设您的架构设置正确,这将嵌入表单.
Assuming that your schema is set up correctly, this will embed the form.
这篇关于在 Symfony 中嵌入表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!