title: Duplicate an AR record & re-insert this into the database
body: <p>I have a AR model that I am trying to duplicated but just need to manually change the foreign key.</p>
  
  <pre><code>$_POST['competition_id'] = 99;
  $prizes = CompetitionPrizes::model()-&gt;findAll('competition_id =:competition_id',array(':competition_id'=&gt; $_POST['competition_id']));
  </code></pre>
  
  <p>This query basically queries the prizes table and gets all the rows for a particular competition. With the prizes object I would like to basically re-insert/duplicate the same information except the competition id which I want to manually set.</p>
  
  <p>I did something similar for an AR object that basically only has one row and that worked well, however in this instance as a competition can have more than one prize this same code won't.</p>
  
  <pre><code>// My existing code for duplication process
  $obj = Competitions::model()-&gt;find('competition_id=:competition_id', array(':competition_id' =&gt; $post['competition_id']));
  $clone = clone $obj;
  $clone-&gt;isNewRecord = true;
  unset($clone-&gt;competition_id); // i want to remove this so it is auto inserted instead via the db
  $clone-&gt;save();
  </code></pre>
  
  <p>This works great - how would I modify this on a 'collection' of prizes and have this duplicated into the database while setting my own 'competition_id' value.</p>
  
  <p>Note - i'm to new to Yii, so please let me know if I have made any obvious errors/bad practice</p>