<p dir="auto">I created a question on SO: <a href="http://stackoverflow.com/questions/25763600/how-to-patch-collection-using-symfony2-forms-and-rest" rel="nofollow">http://stackoverflow.com/questions/25763600/how-to-patch-collection-using-symfony2-forms-and-rest</a></p>
<p dir="auto">The problem is that when I PATCH the data, the "signature" setting is removed from the "settings" collection. However, if I do the same with any direct field of the "user" entity, PATCH request is handled properly (only the field that is included in the request is being changed, and nothing else is being deleted or set to null).</p>
<p dir="auto">Is it anyhow possible to handle this in case of OneToMany collection (i.e. I want to change only one particular setting or some of them, but not all)?</p>
<p dir="auto">I'm trying to update a form collection item with a PATCH request and or <code class="notranslate">$form-&gt;submit($request,false);</code>. Either way, all items are removed from the collection except the new one.</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="        echo &quot;Items from the database ------------------------------------&quot;;
        \Doctrine\Common\Util\Debug::dump($entity-&gt;getItems(), 1);

        $form-&gt;submit($request,false);

        echo &quot;Items in the form ------------------------------------&quot;;
        \Doctrine\Common\Util\Debug::dump($form-&gt;get('items')-&gt;getData());

        echo &quot;updated items ready to save to database&quot;;
        \Doctrine\Common\Util\Debug::dump($entity-&gt;getItems(), 1);"><pre class="notranslate">        <span class="pl-k">echo</span> "<span class="pl-s">Items from the database ------------------------------------</span>";
        \<span class="pl-v">Doctrine</span>\<span class="pl-v">Common</span>\<span class="pl-v">Util</span>\<span class="pl-v">Debug</span>::<span class="pl-en">dump</span>(<span class="pl-s1"><span class="pl-c1">$</span>entity</span>-&gt;<span class="pl-en">getItems</span>(), <span class="pl-c1">1</span>);

        <span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">submit</span>(<span class="pl-s1"><span class="pl-c1">$</span>request</span>,<span class="pl-c1">false</span>);

        <span class="pl-k">echo</span> "<span class="pl-s">Items in the form ------------------------------------</span>";
        \<span class="pl-v">Doctrine</span>\<span class="pl-v">Common</span>\<span class="pl-v">Util</span>\<span class="pl-v">Debug</span>::<span class="pl-en">dump</span>(<span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">get</span>(<span class="pl-s">'items'</span>)-&gt;<span class="pl-en">getData</span>());

        <span class="pl-k">echo</span> "<span class="pl-s">updated items ready to save to database</span>";
        \<span class="pl-v">Doctrine</span>\<span class="pl-v">Common</span>\<span class="pl-v">Util</span>\<span class="pl-v">Debug</span>::<span class="pl-en">dump</span>(<span class="pl-s1"><span class="pl-c1">$</span>entity</span>-&gt;<span class="pl-en">getItems</span>(), <span class="pl-c1">1</span>);</pre></div>
<p dir="auto">I submit the form with modifications for item[0] <code class="notranslate">entity[items][0][description]</code> <code class="notranslate">test 1234</code>.<br>
The output dump is shown below.</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Items from the database ------------------------------------
array(2) {
  [0]=&gt;
  string(29) &quot;CoBo\RecipeBundle\Entity\Item&quot;
  [1]=&gt;
  string(29) &quot;CoBo\RecipeBundle\Entity\Item&quot;
}

Items in the form ------------------------------------
array(1) {
  [0]=&gt;
  object(stdClass)#776 (8) {
    [&quot;__CLASS__&quot;]=&gt;
    string(29) &quot;CoBo\RecipeBundle\Entity\Item&quot;
    [&quot;id&quot;]=&gt;
    int(248)
    [&quot;description&quot;]=&gt;
    string(9) &quot;test 1234&quot;
  }
}

updated items ready to save to database
array(1) {
  [0]=&gt;
  string(29) &quot;CoBo\RecipeBundle\Entity\Item&quot;
}"><pre class="notranslate"><span class="pl-v">Items</span> from the database ------------------------------------
<span class="pl-en">array</span>(<span class="pl-c1">2</span>) {
  [<span class="pl-c1">0</span>]=&gt;
  string(<span class="pl-c1">29</span>) "<span class="pl-s">CoBo\RecipeBundle\Entity\Item</span>"
  [<span class="pl-c1">1</span>]=&gt;
  string(<span class="pl-c1">29</span>) "<span class="pl-s">CoBo\RecipeBundle\Entity\Item</span>"
}

<span class="pl-v">Items</span> in the form ------------------------------------
<span class="pl-en">array</span>(<span class="pl-c1">1</span>) {
  [<span class="pl-c1">0</span>]=&gt;
  object(stdClass)<span class="pl-c">#776 (8) {</span>
    ["<span class="pl-s">__CLASS__</span>"]=&gt;
    string(<span class="pl-c1">29</span>) "<span class="pl-s">CoBo\RecipeBundle\Entity\Item</span>"
    ["<span class="pl-s">id</span>"]=&gt;
    int(<span class="pl-c1">248</span>)
    ["<span class="pl-s">description</span>"]=&gt;
    string(<span class="pl-c1">9</span>) "<span class="pl-s">test 1234</span>"
  }
}

updated items ready to save to database
array(<span class="pl-c1">1</span>) {
  [<span class="pl-c1">0</span>]=&gt;
  string(<span class="pl-c1">29</span>) "<span class="pl-s">CoBo\RecipeBundle\Entity\Item</span>"
}</pre></div>
<p dir="auto">As said, item[1] got removed. I'm not quite sure, if this is the expected behaviour, since a PATCH request should not remove items?!</p>