title: How to save multiple records in cakephp 3
body: <p>I'm very new in cakephp 3. I want to save multiple records with multiple checkbox. 
  I've some events in events table &amp; some passwords in passwords table.
  I want to set different passwords under each events.
  For example- For event 1 I want to set some passwords which will be stored in event_password_all table.</p>
  
  <blockquote>
    <p>(id, event1, password1),
    (id, event1, password2),
    (id, event1, password3),
    …
    …
    (id, event1, passwordN)</p>
  </blockquote>
  
  <p>How can I do that.</p>
  
  <p>Here is my controller code-</p>
  
  <pre><code>    public function add()
  {
      $eventPasswordAll = $this-&gt;EventPasswordAll-&gt;newEntity();
      if ($this-&gt;request-&gt;is('post')) {       
          $eventPasswordAll = $this-&gt;EventPasswordAll-&gt;patchEntity($eventPasswordAll, $this-&gt;request-&gt;data);
          if ($this-&gt;EventPasswordAll-&gt;save($eventPasswordAll)) {
              $this-&gt;Flash-&gt;success(__('The event password all has been saved.'));
              return $this-&gt;redirect(['action' =&gt; 'index']);
          } else {
              $this-&gt;Flash-&gt;error(__('The event password all could not be saved. Please, try again.'));
          }
      }
      $events = $this-&gt;EventPasswordAll-&gt;Events-&gt;find('list', ['limit' =&gt; 200]);
      $passwords = $this-&gt;EventPasswordAll-&gt;Passwords-&gt;find('list', ['limit' =&gt; 200]);
      $this-&gt;set(compact('eventPasswordAll', 'events', 'passwords'));
      $this-&gt;set('_serialize', ['eventPasswordAll']);
  }
  </code></pre>
  
  <p>&amp; here is view-</p>
  
  <pre><code>&lt;div class="eventPasswordAll form large-10 medium-9 columns"&gt;
  &lt;?= $this-&gt;Form-&gt;create($eventPasswordAll) ?&gt;
  &lt;fieldset&gt;
      &lt;legend&gt;&lt;?= __('Add Event Password All') ?&gt;&lt;/legend&gt;
      &lt;?php
          echo $this-&gt;Form-&gt;input('event_id', ['options' =&gt; $events]);
          echo $this-&gt;Form-&gt;input('password_id', ['options' =&gt; $passwords, 'multiple' =&gt; 'checkbox']);
      ?&gt;
  &lt;/fieldset&gt;
  &lt;?= $this-&gt;Form-&gt;button(__('Submit')) ?&gt;
  &lt;?= $this-&gt;Form-&gt;end() ?&gt;
  </code></pre>
  
  <p></p>