在 Symfony 中嵌入表单

编程入门 行业动态 更新时间:2024-10-27 21:18:06
本文介绍了在 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:

www.symfony-project/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 中嵌入表单

本文发布于:2023-10-10 22:55:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1479992.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   Symfony

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!