@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Category\Mapper; |
6 | 6 | |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | |
35 | 35 | public function get($id) |
36 | 36 | { |
37 | - return $this->select(['category_id' => $id])->current(); |
|
37 | + return $this->select([ 'category_id' => $id ])->current(); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function getPaginationSelect() |
41 | 41 | { |
42 | - $select = $this->getSql()->select()->order(['name' => 'asc']); |
|
42 | + $select = $this->getSql()->select()->order([ 'name' => 'asc' ]); |
|
43 | 43 | |
44 | 44 | return $select; |
45 | 45 | } |
@@ -47,18 +47,18 @@ discard block |
||
47 | 47 | public function getCategoryPostsSelect($categoryId = null, $limit = null) |
48 | 48 | { |
49 | 49 | $select = $this->getSql()->select() |
50 | - ->columns(['category_name' => 'name', 'category_slug' => 'slug']) |
|
51 | - ->join('articles', 'articles.category_uuid = category.category_uuid', ['article_id', 'slug', 'admin_user_uuid', 'published_at']) |
|
52 | - ->join('article_posts', 'article_posts.article_uuid = articles.article_uuid', ['*'], 'right') |
|
53 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name', 'face_img']) |
|
54 | - ->where(['articles.status' => 1]) |
|
55 | - ->order(['published_at' => 'desc']); |
|
56 | - |
|
57 | - if($categoryId) { |
|
58 | - $select->where(['category_id' => $categoryId]); |
|
50 | + ->columns([ 'category_name' => 'name', 'category_slug' => 'slug' ]) |
|
51 | + ->join('articles', 'articles.category_uuid = category.category_uuid', [ 'article_id', 'slug', 'admin_user_uuid', 'published_at' ]) |
|
52 | + ->join('article_posts', 'article_posts.article_uuid = articles.article_uuid', [ '*' ], 'right') |
|
53 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name', 'face_img' ]) |
|
54 | + ->where([ 'articles.status' => 1 ]) |
|
55 | + ->order([ 'published_at' => 'desc' ]); |
|
56 | + |
|
57 | + if ($categoryId) { |
|
58 | + $select->where([ 'category_id' => $categoryId ]); |
|
59 | 59 | } |
60 | 60 | |
61 | - if($limit) { |
|
61 | + if ($limit) { |
|
62 | 62 | $select->limit($limit); |
63 | 63 | } |
64 | 64 | |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | $select->where->notEqualTo('slug', 'videos'); |
75 | 75 | $select->where->notEqualTo('slug', 'events'); |
76 | 76 | |
77 | - if($limit) { |
|
77 | + if ($limit) { |
|
78 | 78 | $select->limit($limit); |
79 | 79 | } |
80 | 80 | |
81 | - if($order) { |
|
81 | + if ($order) { |
|
82 | 82 | $select->order($order); |
83 | 83 | } else { |
84 | 84 | $select->order(new Expression('rand()')); |