title: Creating/persisting new document while preUpdate event in doctrine-mongodb
body: <p>I'm using <code>doctrine-mongodb-odm-1.0.0-BETA10</code> and trying to provide some custom logic based on <code>\InitialDocument</code> while <code>preUpdate</code> event running.</p>
  
  <p>Lets say <code>\InitialDocument</code> obtained some state which must behave as initial one for new <code>\StateDocument</code>. I'm doing something like this:</p>
  
  <pre><code>class InitDocListener implements \Doctrine\Common\EventSubscriber {
      public function getSubscribedEvents()
      {
          return [
              Events::preUpdate
          ];
      }
  
      public function preUpdate($args){
          $document = $args-&gt;getDocument();
          if($document instanceOf InitialDocument &amp;&amp; $document-&gt;getState() == 'mine'){
              $stateDocument = new \StateDocument();
              $stateDocument-&gt;setInitDocument($document);
              $args-&gt;getDocumentManager()-&gt;persist($stateDocument);
              //no flush cause recursion happens
          }
      }
  
  }
  </code></pre>
  
  <p><code>prePersist</code> event by <code>\StateDocument</code> happens, but it will not persist new document in db. and <code>postPersist</code> event accordingly will never be fired.</p>
  
  <p>There is some more custom logic but all in event scope. At some point that logic may throw an Exception which must stop update event of <code>InitialDocument</code> so <code>InitialDocument</code> state depends of <code>\StateDocument</code> creation process at business scope.</p>
  
  <p>How can I solve this problem? <code>preFlush</code> event to run before changeSet recalculation do not determine <code>InitialDocument</code> instance. So it is some kind of trick to "search" updates at <code>preFlush</code> and cause me to think it is not proper way. Please advise me in proper one. Thanks.</p>