Skip to content

Commit

Permalink
update user if already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
djaney committed Oct 22, 2015
1 parent 293cadd commit 6ae8129
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Security/User/SSOUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,21 @@ public function loadUserByUsername($userData)

if (!$user) {
$user = new $this->class();

$this->doctrine->getManager()->persist($user);
}
if(isset($userData['username']))
$user->setUsername($userData['username']);
if(isset($userData['email']))
$user->setEmail($userData['email']);
if(isset($userData['firstname']))
$user->setFirstname($userData['firstname']);
if(isset($userData['lastname']))
$user->setLastname($userData['lastname']);
if(isset($userData['roles']))
$user->setRoles($userData['roles']);

$this->doctrine->getManager()->persist($user);
$this->doctrine->getManager()->flush();
}

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

return $user;

}
Expand Down

0 comments on commit 6ae8129

Please sign in to comment.