User without login flushing fix.

This commit is contained in:
Alexey Skobkin 2015-10-01 22:14:30 +03:00
parent 0685e6d8f9
commit dfc7fb70e4

View file

@ -135,13 +135,16 @@ class UserApi extends AbstractApi
if (!$user) { if (!$user) {
$user = new User(); $user = new User();
$user->setId((int) $userData['id']); $user
->setId((int) $userData['id'])
->setLogin($userData['login'])
;
$this->em->persist($user); $this->em->persist($user);
try { try {
$this->em->flush(); $this->em->flush();
} catch (\Exception $e) { } catch (\Exception $e) {
throw new ApiException(sprintf('Error while flushing new user [%d] %s', $user->getId(), $user->getLogin()), 0, $e); throw new ApiException(sprintf('Error while flushing new user [%d] %s: %s', $user->getId(), $user->getLogin(), $e->getMessage()), 0, $e);
} }
} }
@ -156,7 +159,7 @@ class UserApi extends AbstractApi
try { try {
$this->em->flush(); $this->em->flush();
} catch (\Exception $e) { } catch (\Exception $e) {
throw new ApiException(sprintf('Error while flushing changes for [%d] %s', $user->getId(), $user->getLogin()), 0, $e); throw new ApiException(sprintf('Error while flushing changes for [%d] %s: %s', $user->getId(), $user->getLogin(), $e->getMessage()), 0, $e);
} }
$resultUsers[] = $user; $resultUsers[] = $user;