From 032f7a30a916d4631b2dc991fd44963e2cf47db6 Mon Sep 17 00:00:00 2001 From: Tom Anderson Date: Sun, 23 Nov 2014 17:00:57 -0700 Subject: [PATCH] If the identity is not managed, add to entity manager --- Module.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;