title: How to manually dispatch Doctrine/Kernel events in Symfony?
body: <p>I need to dispatch a <code>preRemove</code> event manually as I am soft-deleting an entity thus not really removing it. However I would like to trigger the same listener for when the entity is actually removed.</p>
  <p>Can I use the <code>EventDispatcher</code> (which doesn't expect a <code>LifecycleEventArgs</code>) like for custom events ? What is the best way to dispatch vanilla events ?</p>
  <p><strong>Edit:</strong></p>
  <p>Thanks to bosam answer, this is the way to dispatch vanilla events manually:</p>
  <pre><code>use Doctrine\ORM\Event\LifecycleEventArgs;
  use Doctrine\ORM\Events;
  
  $em = $this-&gt;getDoctrine()-&gt;getManager();
  $eventManager = $em-&gt;getEventManager();
  $eventManager-&gt;dispatchEvent(Events::preRemove, new LifecycleEventArgs($user, $em));
  </code></pre>