title: fromArray, merge in Doctrine2
body: <p>I have a simple table with some fields: id, name.... It will appear in a grid in the browser and the user can add/edit records. That's why in save action I will give array with records where the new records id is a negative number for example:</p>
  
  <pre><code>array[0] = {"id" =&gt; "-1", "name" =&gt; "New record 1"}
  array[1] = {"id" =&gt; "-2", "name" =&gt; "New record 2"}
  array[2] = {"id" =&gt; "1", "name" =&gt; "Exist record 1"}
  array[3] = {"id" =&gt; "2", "name" =&gt; "Exist record 2"}
  </code></pre>
  
  <p>In doctrine 1 I used this:</p>
  
  <pre><code>if (array[x]["id"] &lt; 0) {
    $record = new $MyRecord();
    $record-&gt;fromArray(array[x]);
  } else {
    $record = Doctrine::getTable($MyRecord)-&gt;find(array[x]["id"]);
    $record-&gt;merge(array[x]);
  }
  </code></pre>
  
  <p>but how can I do this in D2?</p>