StudentsTable.php has -
$this->belongsToMany(‘Coupons’, [
‘foreignKey’ => ‘student_id’,
‘targetForeignKey’ => ‘coupon_id’,
‘joinTable’ => ‘coupons_students’,
‘saveStrategy’ => ‘append’,
]);
CouponsTable.php has -
$this->belongsToMany(‘Students’, [
‘foreignKey’ => ‘coupon_id’,
‘targetForeignKey’ => ‘student_id’,
‘joinTable’ => ‘coupons_students’,
‘saveStrategy’ => ‘append’,
]);
CouponsStudentsTable.php has -
$this->belongsTo(‘Coupons’, [
‘foreignKey’ => ‘coupon_id’,
‘joinType’ => ‘INNER’,
]);
$this->belongsTo('Students', [
'foreignKey' => 'student_id',
'joinType' => 'INNER',
]);
When I edit either Students or Coupons, the entry in the CouponsStudents table is replaced, not appended.