title: Stop getting duplicate rows on 'saveAll' in CakePHP
body: <p>In CakePHP when I save the data with the below code, I get the data being saved as expected but I get all the data saved 2 times. The <code>$lesson</code> data variable does not retrieve 2 copies of the data so the save function is the problem. I tried using save in a loop and that gives the same problem. There must be something simple I am doing wrong.</p>
  
  <p><a href="http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-save-array-data-null-boolean-validate-true-array-fieldlist-array" rel="nofollow">http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-save-array-data-null-boolean-validate-true-array-fieldlist-array</a></p>
  
  <pre><code>$data=array();
  $i=0;
  
  $this-&gt;Lessondata-&gt;cacheQueries = false;
  $this-&gt;Lessondata-&gt;create( );
  
  foreach ($lessons as $item):
      //  $this-&gt;Lessondata-&gt;cacheQueries = false; 
  
      $data[$i]['Lessondata']['lesson_id']=$item['Lesson']['id'];
      $data[$i]['Lessondata']['st_id']=$item['Student']['id'];
      $data[$i]['Lessondata']['tutor_id']=$item['Tutor']['id'];
      $data[$i]['Lessondata']['student_name']=$item['Student']['first_name'].' '.$item['Student']['last_name'];
      $data[$i]['Lessondata']['subject']=$item['Subject']['name'];
      $data[$i]['Lessondata']['tutor_name']=$item['Tutor']['first_name'].' '.$item['Tutor']['last_name'];
      $data[$i]['Lessondata']['class_year']=$item['Student']['class_year'];
      //  debug($data[$i]);
      debug($i);
      $i=$i+1;
  
  endforeach;
  
  $this-&gt;Lessondata-&gt;saveAll($data);
  </code></pre>