diff --git a/Module.php b/Module.php index f1fcc01..7eea657 100644 --- a/Module.php +++ b/Module.php @@ -67,7 +67,11 @@ public function getServiceConfig() $auth = $serviceManager->get($auditConfig->getAuthenticationService()); if ($auth->hasIdentity()) { - $auditConfig->setUser($auth->getIdentity()); + if ($auditConfig->getEntityManager()->contains($auth->getIdentity())) { + $auditConfig->setUser($auth->getIdentity()); + } else { + $auditConfig->setUser($auditConfig->getEntityManager()->merge($auth->getIdentity())); + } } return $auditConfig;