Symfony Forms: How can I add new items to a collection without posting the existing collection in my request
<p>I have an entity with a one-to-many relationship to any number of change-log entities. I'd like to be able to post the changes to the parent entity along with a log entry to be added to the log entries collection. I'm wondering about the best way to send a new log entry along with the change-set to the parent entity's form without passing the existing log entries back and forth, and without overwriting existing entries. </p>

<p>I've tried various options, but no matter how I configure the form, when I submit a single log entry along with my changes to the parent, the new log entry overwrites the first of the existing entries.</p>

<p>My present work-around is to set <code>mapped =&gt; false</code> in the log entry form field and, in the controller, to submit the log entry to its own form to populate a <code>new LogEntry</code> entity, then call the parent's <code>addLogEntry($logEntry)</code> method. I'd prefer if I could handle all of the logic in the parent entity's form, but I haven't found a way to do this. </p>

<p>Is there a tidier way to accomplish this?</p>

<p>Here's an example request:</p>

<pre>

{"subscriptions":
    {
        "status": "2",
        "logEntries":[
            {"eventType":"cancel",
            "reason":"testing",
            "origin": "telephone",
            "notes":"test test test"}
        ]
    }
}

</pre>