@@ -77,8 +77,9 @@ |
||
77 | 77 | { |
78 | 78 | $user = $this->entityManager->getRepository(User::class)->find($id); |
79 | 79 | |
80 | - if (!$user) |
|
81 | - throw new EntityNotFoundException('user not found'); |
|
80 | + if (!$user) { |
|
81 | + throw new EntityNotFoundException('user not found'); |
|
82 | + } |
|
82 | 83 | |
83 | 84 | return new Item($user,$this->userTransformer,'user'); |
84 | 85 |
@@ -90,8 +90,9 @@ |
||
90 | 90 | { |
91 | 91 | $article = $this->entityManager->getRepository(Article::class)->find($id); |
92 | 92 | |
93 | - if ($article) |
|
94 | - return new Item($article, $this->articleTransformer, 'article'); |
|
93 | + if ($article) { |
|
94 | + return new Item($article, $this->articleTransformer, 'article'); |
|
95 | + } |
|
95 | 96 | |
96 | 97 | throw new EntityNotFoundException("Article not found"); |
97 | 98 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | try { |
90 | 90 | $article = $this->articleService->getArticleById($id); |
91 | 91 | return new JsonResponse($this->fractalService->transform($article)); |
92 | - }catch (\Exception $e){ |
|
92 | + } catch (\Exception $e){ |
|
93 | 93 | return new JsonResponse($this->fractalService->transform($e->getMessage(),false), Response::HTTP_INTERNAL_SERVER_ERROR); |
94 | 94 | } |
95 | 95 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | try { |
145 | 145 | $this->articleService->addArticle($request); |
146 | 146 | return new JsonResponse($this->fractalService->transform('Article has been added'),Response::HTTP_OK); |
147 | - }catch (\Exception $exception) { |
|
147 | + } catch (\Exception $exception) { |
|
148 | 148 | return new JsonResponse($this->fractalService->transform($exception->getMessage(), false),Response::HTTP_INTERNAL_SERVER_ERROR); |
149 | 149 | } |
150 | 150 |
@@ -95,7 +95,7 @@ |
||
95 | 95 | $user = $this->userService->getUserById($id); |
96 | 96 | return new JsonResponse($this->fractalService->transform($user)); |
97 | 97 | |
98 | - }catch (EntityNotFoundException $exception) { |
|
98 | + } catch (EntityNotFoundException $exception) { |
|
99 | 99 | return new JsonResponse($this->fractalService->transform($exception->getMessage(),false),Response::HTTP_NO_CONTENT); |
100 | 100 | } |
101 | 101 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $resource = $this->createData($resource); |
41 | 41 | |
42 | 42 | $response = array_merge(['success' => $success], $resource->toArray()); |
43 | - }else{ |
|
43 | + } else{ |
|
44 | 44 | $response = [ |
45 | 45 | 'success' => $success, |
46 | 46 | 'message' => $resource |