title: Doctrine inserting in postPersist event
body: <p>I want add new Feed item on entity persist and update. I write this event listener (postUpdate is same):</p>
  
  <pre><code>public function postPersist(LifecycleEventArgs $args)
  {
      $entity = $args-&gt;getEntity();
      $em = $args-&gt;getEntityManager();
  
      if ($entity instanceof FeedItemInterface) {
          $feed = new FeedEntity();
          $feed-&gt;setTitle($entity-&gt;getFeedTitle());
          $feed-&gt;setEntity($entity-&gt;getFeedEntityId());
          $feed-&gt;setType($entity-&gt;getFeedType());
          if($entity-&gt;isFeedTranslatable()) {
              $feed-&gt;getEnTranslation()-&gt;setTitle($entity-&gt;getFeedTitle('en'));
          }
          $em-&gt;persist($feed);
          $em-&gt;flush();
      }
  }
  </code></pre>
  
  <p>But I got </p>
  
  <blockquote>
    <p>Integrity constraint violation: 1062 Duplicate entry '30-2' for key
    'PRIMARY'</p>
  </blockquote>
  
  <p>and in log a have two insertations:</p>
  
  <blockquote>
    <p>INSERT INTO interview_scientificdirection (interview_id,
    scientificdirection_id) VALUES (?, ?) ([30,2])  INSERT INTO
    interview_scientificdirection (interview_id, scientificdirection_id)
    VALUES (?, ?) ([30,2])</p>
  </blockquote>
  
  <p>scientificdirection is Many to Many relationship table for entity what we want to persist.
  In frontend application everything work fine, but in Sonata Admin I got this problem :(</p>