Completed
Push — master ( acb416...4736fa )
by Aleksandar
31:31
created
src/Article/src/Mapper/ArticlePostsMapper.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Article\Mapper;
5 5
 
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
     public function getPaginationSelect()
35 35
     {
36 36
         return $this->getSql()->select()
37
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'is_homepage'])
37
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'is_homepage' ])
38 38
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
39
-            ->join('category', 'articles.category_uuid = category.category_uuid', ['category_name' => 'name'], 'left')
40
-            ->where(['articles.type' => ArticleType::POST])
41
-            ->order(['created_at' => 'desc']);
39
+            ->join('category', 'articles.category_uuid = category.category_uuid', [ 'category_name' => 'name' ], 'left')
40
+            ->where([ 'articles.type' => ArticleType::POST ])
41
+            ->order([ 'created_at' => 'desc' ]);
42 42
     }
43 43
 
44 44
     public function get($id)
45 45
     {
46 46
         $select = $this->getSql()->select()
47
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage'])
47
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage' ])
48 48
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
49 49
             ->join('category', 'category.category_uuid = articles.category_uuid',
50
-                ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left')
51
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left')
52
-            ->where(['articles.article_id' => $id]);
50
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
51
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left')
52
+            ->where([ 'articles.article_id' => $id ]);
53 53
 
54 54
         return $this->selectWith($select)->current();
55 55
     }
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $select = $this->getSql()->select()
60 60
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
61
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug'])
62
-            ->where(['articles.status' => 1])
61
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ])
62
+            ->where([ 'articles.status' => 1 ])
63 63
             ->limit(1);
64 64
 
65
-        if($direction > 0) {
65
+        if ($direction > 0) {
66 66
             $select->where->greaterThan('published_at', $publishedAt);
67
-            $select->order(['published_at' => 'asc']);
68
-        } elseif($direction < 0) {
67
+            $select->order([ 'published_at' => 'asc' ]);
68
+        } elseif ($direction < 0) {
69 69
             $select->where->lessThan('published_at', $publishedAt);
70
-            $select->order(['published_at' => 'desc']);
70
+            $select->order([ 'published_at' => 'desc' ]);
71 71
         }
72 72
 
73 73
         return $this->selectWith($select)->current();
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $select = $this->getSql()->select()
79 79
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
80
-            ->where(['article_posts.is_homepage' => true, 'articles.status' => 1]);
80
+            ->where([ 'article_posts.is_homepage' => true, 'articles.status' => 1 ]);
81 81
 
82 82
         return $this->selectWith($select)->current();
83 83
     }
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
     public function getBySlug($slug)
86 86
     {
87 87
         $select = $this->getSql()->select()
88
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img'])
88
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ])
89 89
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
90
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['category_name' => 'name', 'category_slug' => 'slug'])
91
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name'])
92
-            ->where(['articles.slug' => $slug, 'articles.status' => 1]);
90
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_name' => 'name', 'category_slug' => 'slug' ])
91
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ])
92
+            ->where([ 'articles.slug' => $slug, 'articles.status' => 1 ]);
93 93
 
94 94
         return $this->selectWith($select)->current();
95 95
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     public function getAll()
98 98
     {
99 99
         $select = $this->getSql()->select()
100
-            ->join('articles', 'article_posts.article_uuid = articles.article_uuid', ['article_id', 'slug']);
100
+            ->join('articles', 'article_posts.article_uuid = articles.article_uuid', [ 'article_id', 'slug' ]);
101 101
 
102 102
         return $this->selectWith($select);
103 103
     }
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $select = $this->getSql()->select()
108 108
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
109
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name'])
109
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ])
110 110
             ->join('category', 'category.category_uuid = articles.category_uuid',
111
-                ['category_name' => 'name', 'category_id', 'category_slug' => 'slug'])
112
-            ->where(['articles.status' => 1])
113
-            ->order(['articles.published_at' => 'desc'])
111
+                [ 'category_name' => 'name', 'category_id', 'category_slug' => 'slug' ])
112
+            ->where([ 'articles.status' => 1 ])
113
+            ->order([ 'articles.published_at' => 'desc' ])
114 114
             ->limit($limit);
115 115
 
116 116
         return $this->selectWith($select);
Please login to merge, or discard this patch.