Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #4 from TomHAnderson/non-managed-user
Browse files Browse the repository at this point in the history
If the identity is not managed, add to entity manager
  • Loading branch information
TomHAnderson committed Nov 24, 2014
2 parents aa4e1e0 + 032f7a3 commit 9e832b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9e832b6

Please sign in to comment.