我有两个问题,需要一些帮助。
我有一个由第二个表的外键引用的表:
member_child:
_attributes: { phpName: MemberChild }
id: { type: INTEGER, size: '11', primaryKey: true, autoIncrement: true, required: true }
member_id: { type: INTEGER, size: '11', required: true, foreignTable: member, foreignReference: id }
child_id: { type: INTEGER, size: '11', required: true, foreignTable: child, foreignReference: id }
和孩子:
child:
_attributes: { phpName: Child }
id: { type: INTEGER, size: '11', primaryKey: true, autoIncrement: true, required: true, onDelete: cascade }
username: { type: VARCHAR, size: '45', required: true, defaultValue: '' }
display: { type: TINYINT, size: '1', required: true, defaultValue: '1' }
...etc
(显然这是推进)
现在,当我想使用表单创建子对象时,我需要做两件事:
- 提交时,提交会员ID
- 覆盖 doSave 函数,因此当创建孩子时,我还可以创建 member_child 对象
我怎样才能完成这些问题?