public function onFlush(OnFlushEventArgs $eventArgs)
{
$entityManager = $eventArgs->getEntityManager();
$uow = $entityManager->getUnitOfWork();
foreach ($uow->getScheduledEntityInsertions() as $updated) {
if ($updated instanceof PartCategory) {
$this->updateCategoryPaths($updated, $eventArgs);
}
}
foreach ($uow->getScheduledEntityUpdates() as $updated) {
if ($updated instanceof PartCategory) {
$this->updateCategoryPaths($updated, $eventArgs);
}
}
}