@@ -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 Article\Mapper; |
| 6 | 6 | |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | public function getPaginationSelect($status = null) |
| 37 | 37 | { |
| 38 | 38 | $select = $this->getSql()->select() |
| 39 | - ->columns(['title', 'body', 'longitude', 'latitude']) |
|
| 39 | + ->columns([ 'title', 'body', 'longitude', 'latitude' ]) |
|
| 40 | 40 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
| 41 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name']) |
|
| 42 | - ->where(['articles.type' => ArticleType::EVENT]) |
|
| 43 | - ->order(['created_at' => 'desc']); |
|
| 41 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name' ]) |
|
| 42 | + ->where([ 'articles.type' => ArticleType::EVENT ]) |
|
| 43 | + ->order([ 'created_at' => 'desc' ]); |
|
| 44 | 44 | |
| 45 | - if($status) { |
|
| 46 | - $select->where(['articles.status' => (int)$status]); |
|
| 45 | + if ($status) { |
|
| 46 | + $select->where([ 'articles.status' => (int) $status ]); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $select; |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | $select = $this->getSql()->select() |
| 55 | 55 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
| 56 | 56 | ->join('category', 'category.category_uuid = articles.category_uuid', |
| 57 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left') |
|
| 58 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
| 59 | - ->where(['articles.article_id' => $id]); |
|
| 57 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left') |
|
| 58 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
| 59 | + ->where([ 'articles.article_id' => $id ]); |
|
| 60 | 60 | |
| 61 | 61 | return $this->selectWith($select)->current(); |
| 62 | 62 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | $select = $this->getSql()->select() |
| 67 | 67 | ->join('articles', 'article_events.article_uuid = articles.article_uuid') |
| 68 | 68 | ->join('category', 'category.category_uuid = articles.category_uuid', |
| 69 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left') |
|
| 70 | - ->where(['articles.slug' => $slug]); |
|
| 69 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left') |
|
| 70 | + ->where([ 'articles.slug' => $slug ]); |
|
| 71 | 71 | |
| 72 | 72 | return $this->selectWith($select)->current(); |
| 73 | 73 | } |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | public function getLatest($limit = 50) |
| 76 | 76 | { |
| 77 | 77 | $select = $this->getSql()->select() |
| 78 | - ->join('articles', 'article_events.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at']) |
|
| 79 | - ->where(['articles.status' => 1]) |
|
| 80 | - ->order(['published_at' => 'desc']) |
|
| 78 | + ->join('articles', 'article_events.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
| 79 | + ->where([ 'articles.status' => 1 ]) |
|
| 80 | + ->order([ 'published_at' => 'desc' ]) |
|
| 81 | 81 | ->limit($limit); |
| 82 | 82 | |
| 83 | 83 | return $this->selectWith($select); |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | public function getFuture() |
| 87 | 87 | { |
| 88 | 88 | $select = $this->getSql()->select() |
| 89 | - ->where(['articles.status' => 1]) |
|
| 90 | - ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at']) |
|
| 89 | + ->where([ 'articles.status' => 1 ]) |
|
| 90 | + ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
| 91 | 91 | ->order(new Expression('rand()')); |
| 92 | 92 | |
| 93 | 93 | $select->where->greaterThanOrEqualTo('end_at', date('Y-m-d H:i:s')); |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | public function getPastSelect() |
| 99 | 99 | { |
| 100 | 100 | $select = $this->getSql()->select() |
| 101 | - ->where(['articles.status' => 1]) |
|
| 102 | - ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at']) |
|
| 103 | - ->order(['start_at' => 'desc']); |
|
| 101 | + ->where([ 'articles.status' => 1 ]) |
|
| 102 | + ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
| 103 | + ->order([ 'start_at' => 'desc' ]); |
|
| 104 | 104 | |
| 105 | 105 | $select->where->lessThan('end_at', date('Y-m-d H:i:s')); |
| 106 | 106 | |