title: cakephp Trying to update a MySQL record where record id already exists
body: <p>I am saving multiple records for a model and I want to update existing records if a company_id already exists.</p>
  
  <p>I am using this code in the Model:</p>
  
  <pre><code>function beforeSave() {
  
          $found = $this-&gt;find("first",array(
                  "recursive" =&gt; -1,
                  "conditions" =&gt; array("company_id" =&gt; $this-&gt;data['Osm']['company_id'])));
          if(isset($found))
          {
              $this-&gt;data['Osm']['id'] = $found['Osm']['id'];
          }
          return true;
      }
  </code></pre>
  
  <p>but I am getting the following error: <strong>Error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '60' for key 'PRIMARY'</strong></p>
  
  <p>I understand why I am getting this error but I can't seem to force an update rather than an insert.</p>