title: Create related entities on entity update with Doctrine 2
body: <p>I'm trying to use Doctrine 2 event callbacks to create new related entities, but running into some issues. I'm sure this approach is horribly wrong, but here's the background:</p>
  
  <p>I basically have a Document entity, and a Log entity, when a new Document is created I'm using a prePersist callback to create a related Log entity with a "created" status. This works.</p>
  
  <p>I also want to create a related Log entity with an "updated" status when changes are made, I've tried to use preUpdate to add these related entities, but as expected from reading the docs, it doesn't work:</p>
  
  <blockquote>
    <p>Changes to associations of the updated entity are never allowed in this event, since Doctrine cannot guarantee to correctly handle referential integrity at this point of the flush operation.</p>
  </blockquote>
  
  <p><a href="http://docs.doctrine-project.org/en/2.0.x/reference/events.html" rel="nofollow">http://docs.doctrine-project.org/en/2.0.x/reference/events.html</a></p>
  
  <p>So my question is, what's the correct way to do this?</p>