title: Cakephp 3, Saving form data on association tables
body: <p>Trying to set up an example on how to use join table with extra data I have the following set: <br/></p>
  
  <ul>
  <li>table <code>students</code>: <code>id</code>, <code>name</code>, [...]<br/></li>
  <li>table <code>courses</code>: <code>id</code>, <code>title</code>, [...] <br/></li>
  <li>join table <code>courses_students</code>: <code>id</code>, <code>course_id</code>, <code>student_id</code>, <code>grade</code>, <code>hours_attended</code></li>
  </ul>
  
  <p>The two base table's :</p>
  
  <pre><code>class StudentsTable extends Table {
    public function initialize(array $config) {
      $this-&gt;belongsToMany('Courses', [
          'alias' =&gt; 'Courses',
          'foreignKey' =&gt; 'student_id',
          'targetForeignKey' =&gt; 'course_id',
          'joinTable' =&gt; 'courses_students',
          'through' =&gt; 'CoursesStudents',     
      ]);
  }
  
  class CoursesTable extends Table {
    public function initialize(array $config) {
      $this-&gt;belongsToMany('Students', [
          'alias' =&gt; 'Students',
          'foreignKey' =&gt; 'course_id',
          'targetForeignKey' =&gt; 'student_id',
          'joinTable' =&gt; 'courses_students',
          'through' =&gt; 'CoursesStudents',
      ]);
  }
  </code></pre>
  
  <p>And the association table: </p>
  
  <pre><code>class CoursesStudentsTable extends Table {
    public function initialize(array $config) {
      $this-&gt;belongsTo('Courses', [
          'alias' =&gt; 'Courses',
          'foreignKey' =&gt; 'course_id'
      ]);
      $this-&gt;belongsTo('Students', [
          'alias' =&gt; 'Students',
          'foreignKey' =&gt; 'student_id'
      ]);
  }
  </code></pre>
  
  <p>Having some courses available in the table, I try to add and edit student records. Setting</p>
  
  <pre><code>[courses] =&gt; [_ids]
  </code></pre>
  
  <p>in the student record creates the records in both students table and the association table. </p>
  
  <p>How should the post data array be formed in order to be able to store the <code>grade</code> and <code>hours_attended</code> fields in the association table when saving the student record?</p>