@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public function get($id) |
34 | 34 | { |
35 | - return $this->select(['admin_user_id' => $id])->current(); |
|
35 | + return $this->select([ 'admin_user_id' => $id ])->current(); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function getByEmail(string $email) |
45 | 45 | { |
46 | - return $this->select(['email' => $email])->current(); |
|
46 | + return $this->select([ 'email' => $email ])->current(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function updateLogin(string $userId): int |
56 | 56 | { |
57 | - return $this->update(['last_login' => date('Y-m-d H:i:s')], ['admin_user_id' => $userId]); |
|
57 | + return $this->update([ 'last_login' => date('Y-m-d H:i:s') ], [ 'admin_user_id' => $userId ]); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public function getPaginationSelect($userId) |
61 | 61 | { |
62 | - $select = $this->getSql()->select()->order(['created_at' => 'desc']); |
|
62 | + $select = $this->getSql()->select()->order([ 'created_at' => 'desc' ]); |
|
63 | 63 | |
64 | 64 | $select->where->notEqualTo('admin_user_id', $userId); |
65 | 65 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function getRandom($limit) |
70 | 70 | { |
71 | 71 | $select = $this->getSql()->select() |
72 | - ->where(['status' => 1]) |
|
72 | + ->where([ 'status' => 1 ]) |
|
73 | 73 | ->order(new Expression('rand()')) |
74 | 74 | ->limit($limit); |
75 | 75 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | public function getUuid($adminUserId) |
80 | 80 | { |
81 | - $user = $this->select(['admin_user_id' => $adminUserId])->current(); |
|
81 | + $user = $this->select([ 'admin_user_id' => $adminUserId ])->current(); |
|
82 | 82 | |
83 | 83 | if (!$user) { |
84 | 84 | throw new \Exception('Admin user does not exist!', 400); |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | { |
68 | 68 | $user = $this->session->getStorage()->user; |
69 | 69 | $params = $this->request->getQueryParams(); |
70 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
71 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
70 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
71 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
72 | 72 | |
73 | 73 | $adminUsers = $this->adminUserService->getPagination($page, $limit, $user->admin_user_id); |
74 | 74 | |
75 | 75 | return new HtmlResponse($this->template->render( |
76 | 76 | 'admin::user/index', |
77 | - ['list' => $adminUsers, 'layout' => 'layout/admin']) |
|
77 | + [ 'list' => $adminUsers, 'layout' => 'layout/admin' ]) |
|
78 | 78 | ); |
79 | 79 | } |
80 | 80 | |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return \Psr\Http\Message\ResponseInterface |
85 | 85 | */ |
86 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
86 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
87 | 87 | { |
88 | 88 | $id = $this->request->getAttribute('id'); |
89 | 89 | $user = $this->adminUserService->getUser($id); |
90 | 90 | |
91 | 91 | if ($this->request->getParsedBody()) { |
92 | - $user = (object)($this->request->getParsedBody() + (array)$user); |
|
92 | + $user = (object) ($this->request->getParsedBody() + (array) $user); |
|
93 | 93 | $user->admin_user_id = $id; |
94 | 94 | } |
95 | 95 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin')); |
69 | 69 | } |
70 | 70 | |
71 | - return new HtmlResponse($this->template->render('admin::login', ['layout' => false, 'error' => $error])); |
|
71 | + return new HtmlResponse($this->template->render('admin::login', [ 'layout' => false, 'error' => $error ])); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | $data = $this->request->getParsedBody(); |
86 | - $email = isset($data['email']) ? $data['email'] : null; |
|
87 | - $password = isset($data['password']) ? $data['password'] : null; |
|
86 | + $email = isset($data[ 'email' ]) ? $data[ 'email' ] : null; |
|
87 | + $password = isset($data[ 'password' ]) ? $data[ 'password' ] : null; |
|
88 | 88 | |
89 | 89 | try { |
90 | 90 | $this->session->getStorage()->user = $this->adminUserService->loginUser($email, $password); |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | 'profile_img' => $this->upload->uploadImage($data, 'profile_img') |
135 | 135 | ]; |
136 | 136 | |
137 | - unset($data['confirm_password']); |
|
138 | - $data['password'] = $this->crypt->create($data['password']); |
|
139 | - $data['admin_user_id'] = Uuid::uuid1()->toString(); |
|
140 | - $data['admin_user_uuid'] = (new MysqlUuid($data['admin_user_id']))->toFormat(new Binary); |
|
137 | + unset($data[ 'confirm_password' ]); |
|
138 | + $data[ 'password' ] = $this->crypt->create($data[ 'password' ]); |
|
139 | + $data[ 'admin_user_id' ] = Uuid::uuid1()->toString(); |
|
140 | + $data[ 'admin_user_uuid' ] = (new MysqlUuid($data[ 'admin_user_id' ]))->toFormat(new Binary); |
|
141 | 141 | |
142 | 142 | return $this->adminUsersMapper->insert($data); |
143 | 143 | } |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | $filter = $this->adminUserFilter->getInputFilter()->setData($data); |
152 | 152 | |
153 | 153 | // we dont want to force user to enter the password again |
154 | - if ($data['password'] == '') { |
|
154 | + if ($data[ 'password' ] == '') { |
|
155 | 155 | $filter->remove('password'); |
156 | 156 | $filter->remove('confirm_password'); |
157 | 157 | } |
158 | 158 | |
159 | 159 | // if we want to keep same email |
160 | - if ($user->email == $data['email']) { |
|
160 | + if ($user->email == $data[ 'email' ]) { |
|
161 | 161 | $filter->remove('email'); |
162 | 162 | } |
163 | 163 | |
@@ -171,24 +171,24 @@ discard block |
||
171 | 171 | ]; |
172 | 172 | |
173 | 173 | // We don't want to force user to re-upload image on edit |
174 | - if (!$data['face_img']) { |
|
175 | - unset($data['face_img']); |
|
174 | + if (!$data[ 'face_img' ]) { |
|
175 | + unset($data[ 'face_img' ]); |
|
176 | 176 | } else { |
177 | 177 | $this->upload->deleteFile($user->face_img); |
178 | 178 | } |
179 | 179 | |
180 | - if (!$data['profile_img']) { |
|
181 | - unset($data['profile_img']); |
|
180 | + if (!$data[ 'profile_img' ]) { |
|
181 | + unset($data[ 'profile_img' ]); |
|
182 | 182 | } else { |
183 | 183 | $this->upload->deleteFile($user->profile_img); |
184 | 184 | } |
185 | 185 | |
186 | - if (isset($data['password'])) { |
|
187 | - unset($data['confirm_password']); |
|
188 | - $data['password'] = $this->crypt->create($data['password']); |
|
186 | + if (isset($data[ 'password' ])) { |
|
187 | + unset($data[ 'confirm_password' ]); |
|
188 | + $data[ 'password' ] = $this->crypt->create($data[ 'password' ]); |
|
189 | 189 | } |
190 | 190 | |
191 | - return $this->adminUsersMapper->update($data, ['admin_user_id' => $userId]); |
|
191 | + return $this->adminUsersMapper->update($data, [ 'admin_user_id' => $userId ]); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $this->upload->deleteFile($adminUser->face_img); |
208 | 208 | $this->upload->deleteFile($adminUser->profile_img); |
209 | 209 | |
210 | - return (bool)$this->adminUsersMapper->delete(['admin_user_id' => $userId]); |
|
210 | + return (bool) $this->adminUsersMapper->delete([ 'admin_user_id' => $userId ]); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | [ |
27 | 27 | 'name' => 'first_name', |
28 | 28 | 'required' => true, |
29 | - 'filters' => [['name' => 'StringTrim']], |
|
29 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
30 | 30 | 'validators' => [ |
31 | - ['name' => 'NotEmpty'], |
|
32 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 255]] |
|
31 | + [ 'name' => 'NotEmpty' ], |
|
32 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 255 ] ] |
|
33 | 33 | ], |
34 | 34 | ] |
35 | 35 | ); |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | [ |
39 | 39 | 'name' => 'last_name', |
40 | 40 | 'required' => true, |
41 | - 'filters' => [['name' => 'StringTrim']], |
|
41 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
42 | 42 | 'validators' => [ |
43 | - ['name' => 'NotEmpty'], |
|
44 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 255]] |
|
43 | + [ 'name' => 'NotEmpty' ], |
|
44 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 255 ] ] |
|
45 | 45 | ], |
46 | 46 | ] |
47 | 47 | ); |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | [ |
51 | 51 | 'name' => 'email', |
52 | 52 | 'required' => true, |
53 | - 'filters' => [['name' => 'StringTrim']], |
|
53 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
54 | 54 | 'validators' => [ |
55 | - ['name' => 'NotEmpty'], |
|
56 | - ['name' => 'EmailAddress'], |
|
55 | + [ 'name' => 'NotEmpty' ], |
|
56 | + [ 'name' => 'EmailAddress' ], |
|
57 | 57 | [ |
58 | 58 | 'name' => 'dbnorecordexists', |
59 | - 'options' => ['adapter' => $this->adapter, 'table' => 'admin_users', 'field' => 'email'] |
|
59 | + 'options' => [ 'adapter' => $this->adapter, 'table' => 'admin_users', 'field' => 'email' ] |
|
60 | 60 | ], |
61 | 61 | ], |
62 | 62 | ] |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | [ |
67 | 67 | 'name' => 'introduction', |
68 | 68 | 'required' => false, |
69 | - 'filters' => [['name' => 'StringTrim']] |
|
69 | + 'filters' => [ [ 'name' => 'StringTrim' ] ] |
|
70 | 70 | ] |
71 | 71 | ); |
72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | [ |
75 | 75 | 'name' => 'biography', |
76 | 76 | 'required' => false, |
77 | - 'filters' => [['name' => 'StringTrim']] |
|
77 | + 'filters' => [ [ 'name' => 'StringTrim' ] ] |
|
78 | 78 | ] |
79 | 79 | ); |
80 | 80 | |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | 'name' => 'password', |
84 | 84 | 'required' => true, |
85 | 85 | 'validators' => [ |
86 | - ['name' => 'NotEmpty'], |
|
87 | - ['name' => 'StringLength', 'options' => ['min' => 7, 'max' => 255]] |
|
86 | + [ 'name' => 'NotEmpty' ], |
|
87 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 7, 'max' => 255 ] ] |
|
88 | 88 | ], |
89 | 89 | ] |
90 | 90 | ); |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | 'name' => 'confirm_password', |
95 | 95 | 'required' => true, |
96 | 96 | 'validators' => [ |
97 | - ['name' => 'NotEmpty'], |
|
98 | - ['name' => 'Identical', 'options' => ['token' => 'password']], |
|
97 | + [ 'name' => 'NotEmpty' ], |
|
98 | + [ 'name' => 'Identical', 'options' => [ 'token' => 'password' ] ], |
|
99 | 99 | ], |
100 | 100 | ] |
101 | 101 | ); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | [ |
105 | 105 | 'name' => 'status', |
106 | 106 | 'required' => true, |
107 | - 'validators' => [['name' => 'NotEmpty'], ['name' => 'Digits']] |
|
107 | + 'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Digits' ] ] |
|
108 | 108 | ] |
109 | 109 | ); |
110 | 110 |
@@ -44,9 +44,9 @@ |
||
44 | 44 | public function getCategories($articleId) |
45 | 45 | { |
46 | 46 | $select = $this->getSql()->select() |
47 | - ->columns([]) |
|
48 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['name', 'slug', 'category_id']) |
|
49 | - ->where(['articles.article_id' => $articleId]); |
|
47 | + ->columns([ ]) |
|
48 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'name', 'slug', 'category_id' ]) |
|
49 | + ->where([ 'articles.article_id' => $articleId ]); |
|
50 | 50 | |
51 | 51 | return $this->selectWith($select); |
52 | 52 | } |
@@ -33,24 +33,24 @@ discard block |
||
33 | 33 | public function getPaginationSelect() |
34 | 34 | { |
35 | 35 | return $this->getSql()->select() |
36 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img']) |
|
36 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ]) |
|
37 | 37 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
38 | - ->join('category', 'articles.category_uuid = category.category_uuid', ['category_name' => 'name'], 'left') |
|
39 | - ->where(['articles.type' => ArticleType::POST]) |
|
40 | - ->order(['created_at' => 'desc']); |
|
38 | + ->join('category', 'articles.category_uuid = category.category_uuid', [ 'category_name' => 'name' ], 'left') |
|
39 | + ->where([ 'articles.type' => ArticleType::POST ]) |
|
40 | + ->order([ 'created_at' => 'desc' ]); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function get($id) |
44 | 44 | { |
45 | 45 | $select = $this->getSql()->select() |
46 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout']) |
|
46 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout' ]) |
|
47 | 47 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
48 | 48 | ->join( |
49 | 49 | 'category', 'category.category_uuid = articles.category_uuid', |
50 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left' |
|
50 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left' |
|
51 | 51 | ) |
52 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
53 | - ->where(['articles.article_id' => $id]); |
|
52 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
53 | + ->where([ 'articles.article_id' => $id ]); |
|
54 | 54 | |
55 | 55 | return $this->selectWith($select)->current(); |
56 | 56 | } |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | { |
60 | 60 | $select = $this->getSql()->select() |
61 | 61 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
62 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug']) |
|
63 | - ->where(['articles.status' => 1]) |
|
62 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ]) |
|
63 | + ->where([ 'articles.status' => 1 ]) |
|
64 | 64 | ->limit(1); |
65 | 65 | |
66 | 66 | if ($direction > 0) { |
67 | 67 | $select->where->greaterThan('published_at', $publishedAt); |
68 | - $select->order(['published_at' => 'asc']); |
|
68 | + $select->order([ 'published_at' => 'asc' ]); |
|
69 | 69 | } elseif ($direction < 0) { |
70 | 70 | $select->where->lessThan('published_at', $publishedAt); |
71 | - $select->order(['published_at' => 'desc']); |
|
71 | + $select->order([ 'published_at' => 'desc' ]); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $this->selectWith($select)->current(); |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | public function getBySlug($slug) |
78 | 78 | { |
79 | 79 | $select = $this->getSql()->select() |
80 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img']) |
|
80 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ]) |
|
81 | 81 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
82 | 82 | ->join( |
83 | 83 | 'category', |
84 | 84 | 'category.category_uuid = articles.category_uuid', |
85 | - ['category_name' => 'name', 'category_slug' => 'slug'] |
|
85 | + [ 'category_name' => 'name', 'category_slug' => 'slug' ] |
|
86 | 86 | )->join( |
87 | 87 | 'admin_users', |
88 | 88 | 'admin_users.admin_user_uuid = articles.admin_user_uuid', |
89 | - ['first_name', 'last_name']) |
|
90 | - ->where(['articles.slug' => $slug, 'articles.status' => 1]); |
|
89 | + [ 'first_name', 'last_name' ]) |
|
90 | + ->where([ 'articles.slug' => $slug, 'articles.status' => 1 ]); |
|
91 | 91 | |
92 | 92 | return $this->selectWith($select)->current(); |
93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function getAll() |
96 | 96 | { |
97 | 97 | $select = $this->getSql()->select() |
98 | - ->join('articles', 'article_posts.article_uuid = articles.article_uuid', ['article_id', 'slug']); |
|
98 | + ->join('articles', 'article_posts.article_uuid = articles.article_uuid', [ 'article_id', 'slug' ]); |
|
99 | 99 | |
100 | 100 | return $this->selectWith($select); |
101 | 101 | } |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | { |
105 | 105 | $select = $this->getSql()->select() |
106 | 106 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
107 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name']) |
|
107 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ]) |
|
108 | 108 | ->join( |
109 | 109 | 'category', 'category.category_uuid = articles.category_uuid', |
110 | - ['category_name' => 'name', 'category_id', 'category_slug' => 'slug'] |
|
110 | + [ 'category_name' => 'name', 'category_id', 'category_slug' => 'slug' ] |
|
111 | 111 | ) |
112 | - ->where(['articles.status' => 1]) |
|
113 | - ->order(['articles.published_at' => 'desc']) |
|
112 | + ->where([ 'articles.status' => 1 ]) |
|
113 | + ->order([ 'articles.published_at' => 'desc' ]) |
|
114 | 114 | ->limit($limit); |
115 | 115 | |
116 | 116 | return $this->selectWith($select); |
@@ -22,23 +22,23 @@ |
||
22 | 22 | public function getPaginationSelect() |
23 | 23 | { |
24 | 24 | return $this->getSql()->select() |
25 | - ->columns(['title', 'body']) |
|
25 | + ->columns([ 'title', 'body' ]) |
|
26 | 26 | ->join('articles', 'article_discussions.article_uuid = articles.article_uuid') |
27 | - ->where(['articles.type' => ArticleType::DISCUSSION]) |
|
28 | - ->order(['created_at' => 'desc']); |
|
27 | + ->where([ 'articles.type' => ArticleType::DISCUSSION ]) |
|
28 | + ->order([ 'created_at' => 'desc' ]); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function get($id) |
32 | 32 | { |
33 | 33 | $select = $this->getSql()->select() |
34 | - ->columns(['title', 'body']) |
|
34 | + ->columns([ 'title', 'body' ]) |
|
35 | 35 | ->join('articles', 'article_discussions.article_uuid = articles.article_uuid') |
36 | 36 | ->join( |
37 | 37 | 'category', 'category.category_uuid = articles.category_uuid', |
38 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left' |
|
38 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left' |
|
39 | 39 | ) |
40 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
41 | - ->where(['articles.article_id' => $id]); |
|
40 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
41 | + ->where([ 'articles.article_id' => $id ]); |
|
42 | 42 | |
43 | 43 | return $this->selectWith($select)->current(); |
44 | 44 | } |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | |
69 | 69 | $article = $articleFilter->getValues(); |
70 | 70 | $article += [ |
71 | - 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article['admin_user_id']), |
|
71 | + 'admin_user_uuid' => $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]), |
|
72 | 72 | 'type' => ArticleType::DISCUSSION, |
73 | 73 | 'article_id' => $id, |
74 | 74 | 'article_uuid' => $uuId |
75 | 75 | ]; |
76 | 76 | |
77 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
78 | - unset($article['category_id'], $article['admin_user_id']); |
|
77 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
78 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
79 | 79 | |
80 | - $discussion = $discussionFilter->getValues() + ['article_uuid' => $uuId]; |
|
80 | + $discussion = $discussionFilter->getValues() + [ 'article_uuid' => $uuId ]; |
|
81 | 81 | |
82 | 82 | $this->articleMapper->insert($article); |
83 | 83 | $this->articleDiscussionsMapper->insert($discussion); |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | throw new FilterException($articleFilter->getMessages() + $discussionFilter->getMessages()); |
94 | 94 | } |
95 | 95 | |
96 | - $article = $articleFilter->getValues() + ['article_uuid' => $article->article_uuid]; |
|
96 | + $article = $articleFilter->getValues() + [ 'article_uuid' => $article->article_uuid ]; |
|
97 | 97 | $discussion = $discussionFilter->getValues(); |
98 | 98 | |
99 | - $article['admin_user_uuid'] = $this->adminUsersMapper->getUuid($article['admin_user_id']); |
|
100 | - $article['category_uuid'] = $this->categoryMapper->get($article['category_id'])->category_uuid; |
|
101 | - unset($article['category_id'], $article['admin_user_id']); |
|
99 | + $article[ 'admin_user_uuid' ] = $this->adminUsersMapper->getUuid($article[ 'admin_user_id' ]); |
|
100 | + $article[ 'category_uuid' ] = $this->categoryMapper->get($article[ 'category_id' ])->category_uuid; |
|
101 | + unset($article[ 'category_id' ], $article[ 'admin_user_id' ]); |
|
102 | 102 | |
103 | - $this->articleMapper->update($article, ['article_uuid' => $article['article_uuid']]); |
|
104 | - $this->articleDiscussionsMapper->update($discussion, ['article_uuid' => $article['article_uuid']]); |
|
103 | + $this->articleMapper->update($article, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
104 | + $this->articleDiscussionsMapper->update($discussion, [ 'article_uuid' => $article[ 'article_uuid' ] ]); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function deleteArticle($id) |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | throw new \Exception('Article not found!'); |
113 | 113 | } |
114 | 114 | |
115 | - $this->articleDiscussionsMapper->delete(['article_uuid' => $discussion->article_uuid]); |
|
115 | + $this->articleDiscussionsMapper->delete([ 'article_uuid' => $discussion->article_uuid ]); |
|
116 | 116 | $this->delete($discussion->article_uuid); |
117 | 117 | } |
118 | 118 | } |