Skip to content

Commit

Permalink
Update SSOUserProvider.php
Browse files Browse the repository at this point in the history
  • Loading branch information
djaney committed Oct 22, 2015
1 parent 6ae8129 commit 5bb306b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Security/User/SSOUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public function loadUserByUsername($userData)
$user = $this->doctrine->getRepository($this->class)->findOneByUsername($userData);
}


$new = false;
if (!$user) {
$user = new $this->class();
$this->doctrine->getManager()->persist($user);
$new = true;
}
if(isset($userData['username']))
$user->setUsername($userData['username']);
Expand All @@ -41,6 +41,10 @@ public function loadUserByUsername($userData)
if(isset($userData['roles']))
$user->setRoles($userData['roles']);

if($new){
$this->doctrine->getManager()->persist($user);
}

$this->doctrine->getManager()->flush();

return $user;
Expand Down

0 comments on commit 5bb306b

Please sign in to comment.