samedi 16 janvier 2016

Many to Many relationship in emberfire

I was wondering wether it is possible to create a many to many relationship in emberfire. I've got the following models:

//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})

And then in my employee controller:

update(subjects) {
      this.get('model.employee').set('subjects',subjects);
      this.get('model.employee').save();

    }

But his only adds it to my /employees endpoint. Is there anyway to make the relationship mutual so to speak?




Aucun commentaire:

Enregistrer un commentaire