title: Cakephp 1.3 Save Multiple Model rows, some with an id and some without an id
body: <p>Is it possible to update existing data and save new data at the same time without having to loop through the array? I would like the array with the id to update and the array without an id to create a new entry. See the example below. Thank you for your help.</p>
  
  <pre><code>[Workload] =&gt; Array
      (
          [0] =&gt; Array
              (
                  [phase_count] =&gt; 1
                  [id] =&gt; 17
                  [value] =&gt; {"phases":[{"rep_range":"20-30","rep_set_count":"1"}]}
                  [user_id] =&gt; 1
              )
  
          [4] =&gt; Array
              (
                  [phase_count] =&gt; 1
                  [value] =&gt; {"phases":[{"rep_range":"20-30","rep_set_count":"1"}]}
                  [user_id] =&gt; 1
              )
  );
  </code></pre>
  
  <p>and then this</p>
  
  <pre><code>$this-&gt;Workload-&gt;saveAll($this-&gt;data['Workload']);
  </code></pre>
  
  <p>EDIT ======================================</p>
  
  <p>Here is the code that actually saves this array</p>
  
  <pre><code>   if($this-&gt;data){
          array_walk($this-&gt;data['Workload'], function (&amp;$value,$index){
              // This will need to be changed once users are setup
              if(empty($value['user_id'])){
                  $value['user_id'] = 1;
              }
              $value['value'] = json_encode($value['value']);
          });
          debug($this-&gt;data);
          $this-&gt;Workload-&gt;saveAll($this-&gt;data['Workload']);
  </code></pre>