【发布时间】:2012-01-20 12:29:47
【问题描述】:
我有以下架构,我想使用 Symfony 1.4 和 Doctrine 创建一个表单,用户可以从选择框中选择杂志,然后单击多个复选框,其中每个复选框都是一个问题。
在伪标记中应该是这样的:
[选择]杂志[/选择]
[复选框]问题 1[复选框]
[复选框]问题 2[复选框]
[复选框]问题 3[复选框]
[复选框]问题 4[复选框]
[复选框]问题 5[复选框]
如果表单被保存,它应该为每个选中的复选框创建一个记录集。广告 ID 通过 url 传递给表单。
我尝试了几种方法来实现这一点,但我坚持了几个星期,希望这里有人可以帮助我。
在实际项目中,我需要收集 25 个所描述的表单,但如果我只是让这个基本表单正常工作,这将不是问题。
我应该创建一个广告表格并将规划表格嵌入其中吗?我总是用 Planing 表格直接尝试它。
非常感谢任何建议、提示或帮助。 对不起,我的英语很差。
Advertisement:
columns:
title: { type: string(100), notnull: true }
Issue:
columns:
magazine_id: { type: integer, notnull: true }
number: { type: string(10), notnull: true }
relations:
Magazine:
local: magazine_id
foreign: id
foreignAlias: Issues
type: one
foreignType: many
Magazine:
columns:
title: { type: string(100) }
Planing:
columns:
advertisement_id: { type: integer, notnull: true }
magazine_id: { type: integer, notnull: true }
issue_id: { type: integer, notnull: true }
relations:
Issue:
local: issue_id
foreign: id
foreignAlias: Planings
type: one
foreignType: many
Advertisement:
local: advertisement_id
foreign: id
foreignAlias: Planings
type: one
foreignType: many
Magazine:
local: magazine_id
foreign: id
foreignAlias: Planings
type: one
foreignType: many
【问题讨论】:
标签: forms symfony1 doctrine symfony-1.4