我想知道是否可以在 emberfire 中创建多对多关系。我有以下型号:
//Employee
name: DS.attr('string'),
position: DS.attr('string'),
accessoryPosition: DS.attr('string'),
education: DS.attr('string'),
experience: DS.attr('string'),
imgUrl: DS.attr('string'),
teachingIn: DS.attr('string'),
subjects: DS.hasMany('subject', {async: true})
//Subject
name: DS.attr('string'),
courseDescriptionUrl: DS.attr('string'),
description: DS.attr('string'),
examDescriptionUrl: DS.attr('string'),
imgUrl: DS.attr('string'),
sportsSubject: DS.attr('boolean'),
outdoorSubject: DS.attr('boolean'),
commonSubject: DS.attr('boolean'),
teachers: DS.hasMany('employee', {async : true})
然后在我的员工控制器中:
update(subjects) {
this.get('model.employee').set('subjects',subjects);
this.get('model.employee').save();
}
但他只将它添加到我的 /employees 端点。无论如何,可以说这种关系是相互的吗?