title: CakePHP 3.x: saving multiple records
body: <p>I've read <a href="http://book.cakephp.org/3.0/en/orm/saving-data.html#converting-multiple-records">Converting Multiple Records</a>. Now I'm trying to save multiple photos at once from a form.</p>
  
  <p>With:</p>
  
  <pre><code>debug($this-&gt;request-&gt;data);
  </code></pre>
  
  <p>I've this:</p>
  
  <pre><code>[
      (int) 1 =&gt; [
          'filename' =&gt; '25483_106728809362869_5795827_n.jpg',
          'description' =&gt; '',
          'album_id' =&gt; '2'
      ],
      (int) 3 =&gt; [
          'filename' =&gt; '44569_193398817463220_816845208_n.jpg',
          'description' =&gt; '',
          'album_id' =&gt; '1'
      ]
  ]
  </code></pre>
  
  <p>It seems ok.</p>
  
  <p>Bake has created for me this action method:</p>
  
  <pre><code>public function add() {
          $photo = $this-&gt;Photos-&gt;newEntity();
  
          if($this-&gt;request-&gt;is('post')) {
              $photo = $this-&gt;Photos-&gt;patchEntity($photo, $this-&gt;request-&gt;data);
  
              if($this-&gt;Photos-&gt;save($photo)) {
                  return $this-&gt;redirect(['action' =&gt; 'index']);
              }
          }
  
          $this-&gt;set(compact('photo'));
      }
  </code></pre>
  
  <p>But the CakeBook doesn't explain well how to proceed. I sense I have to use <code>newEntities()</code> and <code>patchEntities()</code>, but I don't quite understand how to do.</p>
  
  <p>For example: why the <code>newEntity()</code> method can accept NULL, while the method <code>newEntities()</code> necessarily wants an argument??
  The <code>save()</code> method accepts only one entity at a time? So, I have to cycle saving for each entity?</p>
  
  <p>Can I have a small example? Thanks.</p>