From dfc7fb70e4b60cb9e960394b9efaf896d32976cf Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Thu, 1 Oct 2015 22:14:30 +0300 Subject: [PATCH] User without login flushing fix. --- src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php b/src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php index d8476e2..09d5dc2 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Service/UserApi.php @@ -135,13 +135,16 @@ class UserApi extends AbstractApi if (!$user) { $user = new User(); - $user->setId((int) $userData['id']); + $user + ->setId((int) $userData['id']) + ->setLogin($userData['login']) + ; $this->em->persist($user); try { $this->em->flush(); } 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 { $this->em->flush(); } 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;