title: Very simple example of event listener on preUpdate() event of an object hangs/fails
body: <p>Event Listener example below works fine for <code>prePersist()</code> and <code>postPersist()</code> however browser times out for <code>preUpdate()</code> and <code>postUpdate()</code>. Anyone knows why this is happening?</p>
  
  <p>Note: Event listener is the one which cause problem because controller works fine when used on its own. I checked the database.</p>
  
  <p>Error:</p>
  
  <pre><code>Maximum execution time of 30 seconds exceeded in /var/www/html/local/listener/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 685
  </code></pre>
  
  <p><strong>Event listener</strong></p>
  
  <pre><code>class UserListener
  {
      //public function postUpdate(LifecycleEventArgs $args)
      public function preUpdate(LifecycleEventArgs $args)
      {
          $entity = $args-&gt;getEntity();
  
          if ($entity instanceof User) {
              $userLog = new UserLog();
              $userLog-&gt;setDescription('User Update.');
  
              $em = $args-&gt;getEntityManager();
              $em-&gt;persist($userLog);
              $em-&gt;flush();
          }
      }
  }
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>public function updateUser()
  {
      $repo = $this-&gt;getDoctrine()-&gt;getRepository('SiteFrontBundle:User');
      $user = $repo-&gt;findOneBy(array('id' =&gt; 1));
      $user-&gt;setLock(true);
  
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      $em-&gt;flush();
  }
  </code></pre>
  
  <p><strong>Service.yml</strong></p>
  
  <pre><code>services:
  
      entity.event_listener.user:
          class:  Site\FrontBundle\EventListener\Entity\UserListener
          tags:
              - { name: doctrine.event_listener, event: preUpdate }
  </code></pre>