Completed
Push — master ( 072543...66893c )
by Aleksandar
69:44 queued 49:14
created
src/Article/src/Mapper/ArticlePostsMapper.php 1 patch
Spacing   +23 added lines, -23 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,21 +34,21 @@  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
-            ->where(['articles.article_id' => $id]);
50
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
51
+            ->where([ 'articles.article_id' => $id ]);
52 52
 
53 53
         return $this->selectWith($select)->current();
54 54
     }
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $select = $this->getSql()->select()
59 59
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
60
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug'])
60
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ])
61 61
             ->limit(1);
62 62
 
63
-        if($direction > 0) {
63
+        if ($direction > 0) {
64 64
             $select->where->greaterThan('published_at', $publishedAt);
65
-            $select->order(['published_at' => 'asc']);
66
-        } elseif($direction < 0) {
65
+            $select->order([ 'published_at' => 'asc' ]);
66
+        } elseif ($direction < 0) {
67 67
             $select->where->lessThan('published_at', $publishedAt);
68
-            $select->order(['published_at' => 'desc']);
68
+            $select->order([ 'published_at' => 'desc' ]);
69 69
         }
70 70
 
71 71
         return $this->selectWith($select)->current();
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     {
76 76
         $select = $this->getSql()->select()
77 77
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
78
-            ->where(['article_posts.is_homepage' => true, 'articles.status' => 1]);
78
+            ->where([ 'article_posts.is_homepage' => true, 'articles.status' => 1 ]);
79 79
 
80 80
         return $this->selectWith($select)->current();
81 81
     }
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
     public function getBySlug($slug)
84 84
     {
85 85
         $select = $this->getSql()->select()
86
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img'])
86
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ])
87 87
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
88
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['category_name' => 'name', 'category_slug' => 'slug'])
89
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name'])
90
-            ->where(['articles.slug' => $slug, 'articles.status' => 1]);
88
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_name' => 'name', 'category_slug' => 'slug' ])
89
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ '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
 block discarded – undo
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,11 +104,11 @@  discard block
 block discarded – undo
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('category', 'category.category_uuid = articles.category_uuid',
109
-                ['category_name' => 'name', 'category_id', 'category_slug' => 'slug'])
110
-            ->where(['articles.status' => 1])
111
-            ->order(['articles.published_at' => 'desc'])
109
+                [ 'category_name' => 'name', 'category_id', 'category_slug' => 'slug' ])
110
+            ->where([ 'articles.status' => 1 ])
111
+            ->order([ 'articles.published_at' => 'desc' ])
112 112
             ->limit($limit);
113 113
 
114 114
         return $this->selectWith($select);
Please login to merge, or discard this patch.