title: How to implement CRUD with many:many relationship
body: <p>I'm new to atk4, but I couldn't find some simple examples for using CRUD with many:many relationships between tables.</p>
  <p>I read in some instructions that M:M is best implemented with intermediate table, which seems logical.</p>
  <p>For example</p>
  <pre><code>Model ONE has:
  $this-&gt;hasMany('Table1Table2','table1_id');
  
  Model TWO has:
  $this-&gt;hasMany('Table1Table2','table2_id');
  
  And Intermediate Model (Table1Table2) has:
  $this-&gt;hasOne('Table1');
  $this-&gt;hasOne('Table2');
  </code></pre>
  <p>Which generates this table, which is OK:</p>
  <pre><code>create table table1table2 (  
    id int auto_increment not null primary key,
    table1_id varchar(255),
    table2_id varchar(255));
  </code></pre>
  <p>But how to implement CRUD? - how to implement listings, adding new, edit etc..</p>
  <p>When on page I simply insert like this:</p>
  <pre><code>$this-&gt;add('CRUD')-&gt;setModel('Table1');
  </code></pre>
  <p>There is no relationship generated... It would be nice that user could select (on add and edit of table1) values from table2.</p>
  <p>From reading and watching tutorials I have idea, but maybe is totally overwork, so I'm really asking what is the best way at ATK4 for this problem?</p>
  <p>My idea:</p>
  <ul>
  <li>add multiple dropdown to edit and add form and populate it with table2 values. If in edit, check in intermediate table for what is already checked.</li>
  <li>extend basic CRUD, on formSubmitSuccess insert selected values from dropdown to intermediate table</li>
  <li>do it differently for edit/add new..</li>
  <li>later, do similar check for GRID&amp;other stuff... can generate a lot of extra work..</li>
  </ul>
  <p>So, I see its doable, but I'm sure M:M relationships are very common (it's basically two 1:M), so maybe is there much better solution?</p>