protected function getPostFlush()
{
return function ($proxy, $instance, $method, $params, $returnValue, &$returnEarly) {
/** @var EntityManager $instance */
$event = new FlushEvent($instance);
$event->setReturnValue($instance);
$instance->getDispatcher()->dispatch(Event::POST_FLUSH, $event);
if ($event->getAbort()) {
$returnEarly = true;
return $event->getReturnValue();
}
return $returnValue;
};
}