Completed
Push — master ( 12d41d...072543 )
by Aleksandar
27:33
created
src/Article/src/Mapper/ArticleEventsMapper.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,8 +54,8 @@  discard block
 block discarded – undo
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
-            ->where(['articles.article_id' => $id]);
57
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
58
+            ->where([ 'articles.article_id' => $id ]);
59 59
 
60 60
         return $this->selectWith($select)->current();
61 61
     }
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $select = $this->getSql()->select()
66 66
             ->join('articles', 'article_events.article_uuid = articles.article_uuid')
67
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['*'], 'left')
68
-            ->where(['articles.slug' => $slug]);
67
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ '*' ], 'left')
68
+            ->where([ 'articles.slug' => $slug ]);
69 69
 
70 70
         return $this->selectWith($select)->current();
71 71
     }
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
     public function getLatest($limit = 50)
74 74
     {
75 75
         $select = $this->getSql()->select()
76
-            ->join('articles', 'article_events.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at'])
77
-            ->where(['articles.status' => 1])
78
-            ->order(['published_at' => 'desc'])
76
+            ->join('articles', 'article_events.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ])
77
+            ->where([ 'articles.status' => 1 ])
78
+            ->order([ 'published_at' => 'desc' ])
79 79
             ->limit($limit);
80 80
 
81 81
         return $this->selectWith($select);
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
     public function getFuture()
85 85
     {
86 86
         $select = $this->getSql()->select()
87
-            ->where(['articles.status' => 1])
88
-            ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at'])
87
+            ->where([ 'articles.status' => 1 ])
88
+            ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ])
89 89
             ->order(new Expression('rand()'));
90 90
 
91 91
         $select->where->greaterThanOrEqualTo('end_at', date('Y-m-d H:i:s'));
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
     public function getPastSelect()
97 97
     {
98 98
         $select = $this->getSql()->select()
99
-            ->where(['articles.status' => 1])
100
-            ->join('articles', 'articles.article_uuid = article_events.article_uuid', ['article_id', 'slug', 'published_at'])
101
-            ->order(['start_at' => 'desc']);
99
+            ->where([ 'articles.status' => 1 ])
100
+            ->join('articles', 'articles.article_uuid = article_events.article_uuid', [ 'article_id', 'slug', 'published_at' ])
101
+            ->order([ 'start_at' => 'desc' ]);
102 102
 
103 103
         $select->where->lessThan('end_at', date('Y-m-d H:i:s'));
104 104
 
Please login to merge, or discard this patch.
src/Article/src/Mapper/ArticlePostsMapper.php 1 patch
Spacing   +22 added lines, -22 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,20 +34,20 @@  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
-            ->where(['articles.type' => ArticleType::POST])
40
-            ->order(['created_at' => 'desc']);
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', 'is_homepage'])
46
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout', 'is_homepage' ])
47 47
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
48 48
             ->join('category', 'category.category_uuid = articles.category_uuid',
49
-                ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left')
50
-            ->where(['articles.article_id' => $id]);
49
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
50
+            ->where([ 'articles.article_id' => $id ]);
51 51
 
52 52
         return $this->selectWith($select)->current();
53 53
     }
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $select = $this->getSql()->select()
58 58
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
59
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug'])
59
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ])
60 60
             ->limit(1);
61 61
 
62
-        if($direction > 0) {
62
+        if ($direction > 0) {
63 63
             $select->where->greaterThan('published_at', $publishedAt);
64
-            $select->order(['published_at' => 'asc']);
65
-        } elseif($direction < 0) {
64
+            $select->order([ 'published_at' => 'asc' ]);
65
+        } elseif ($direction < 0) {
66 66
             $select->where->lessThan('published_at', $publishedAt);
67
-            $select->order(['published_at' => 'desc']);
67
+            $select->order([ 'published_at' => 'desc' ]);
68 68
         }
69 69
 
70 70
         return $this->selectWith($select)->current();
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $select = $this->getSql()->select()
76 76
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
77
-            ->where(['article_posts.is_homepage' => true, 'articles.status' => 1]);
77
+            ->where([ 'article_posts.is_homepage' => true, 'articles.status' => 1 ]);
78 78
 
79 79
         return $this->selectWith($select)->current();
80 80
     }
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
     public function getBySlug($slug)
83 83
     {
84 84
         $select = $this->getSql()->select()
85
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img'])
85
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ])
86 86
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
87
-            ->join('category', 'category.category_uuid = articles.category_uuid', ['category_name' => 'name', 'category_slug' => 'slug'])
88
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name'])
89
-            ->where(['articles.slug' => $slug, 'articles.status' => 1]);
87
+            ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_name' => 'name', 'category_slug' => 'slug' ])
88
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ])
89
+            ->where([ 'articles.slug' => $slug, 'articles.status' => 1 ]);
90 90
 
91 91
         return $this->selectWith($select)->current();
92 92
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     public function getAll()
95 95
     {
96 96
         $select = $this->getSql()->select()
97
-            ->join('articles', 'article_posts.article_uuid = articles.article_uuid', ['article_id', 'slug']);
97
+            ->join('articles', 'article_posts.article_uuid = articles.article_uuid', [ 'article_id', 'slug' ]);
98 98
 
99 99
         return $this->selectWith($select);
100 100
     }
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
     {
104 104
         $select = $this->getSql()->select()
105 105
             ->join('articles', 'article_posts.article_uuid = articles.article_uuid')
106
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name'])
106
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ])
107 107
             ->join('category', 'category.category_uuid = articles.category_uuid',
108
-                ['category_name' => 'name', 'category_id', 'category_slug' => 'slug'])
109
-            ->where(['articles.status' => 1])
110
-            ->order(['articles.published_at' => 'desc'])
108
+                [ 'category_name' => 'name', 'category_id', 'category_slug' => 'slug' ])
109
+            ->where([ 'articles.status' => 1 ])
110
+            ->order([ 'articles.published_at' => 'desc' ])
111 111
             ->limit($limit);
112 112
 
113 113
         return $this->selectWith($select);
Please login to merge, or discard this patch.
src/Article/src/Mapper/ArticleVideosMapper.php 1 patch
Spacing   +14 added lines, -14 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,13 +34,13 @@  discard block
 block discarded – undo
34 34
     public function getPaginationSelect($isActive = null)
35 35
     {
36 36
         $select = $this->getSql()->select()
37
-            ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['slug', 'published_at', 'status', 'article_id'])
38
-            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name'])
39
-            ->where(['articles.type' => ArticleType::POST])
40
-            ->order(['articles.created_at' => 'desc']);
37
+            ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'slug', 'published_at', 'status', 'article_id' ])
38
+            ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name' ])
39
+            ->where([ 'articles.type' => ArticleType::POST ])
40
+            ->order([ 'articles.created_at' => 'desc' ]);
41 41
 
42
-        if($isActive !== null) {
43
-            $select->where(['articles.status' => (int)$isActive]);
42
+        if ($isActive !== null) {
43
+            $select->where([ 'articles.status' => (int) $isActive ]);
44 44
         }
45 45
 
46 46
         return $select;
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
     public function get($id)
50 50
     {
51 51
         $select = $this->getSql()->select()
52
-            ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title'])
52
+            ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title' ])
53 53
             ->join('articles', 'article_videos.article_uuid = articles.article_uuid')
54 54
             ->join('category', 'category.category_uuid = articles.category_uuid',
55
-                ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left')
56
-            ->where(['articles.article_id' => $id]);
55
+                [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left')
56
+            ->where([ 'articles.article_id' => $id ]);
57 57
 
58 58
         return $this->selectWith($select)->current();
59 59
     }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
     public function getLatest($limit = 50)
62 62
     {
63 63
         $select = $this->getSql()->select()
64
-            ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at'])
65
-            ->where(['articles.status' => 1])
66
-            ->order(['published_at' => 'desc'])
64
+            ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ])
65
+            ->where([ 'articles.status' => 1 ])
66
+            ->order([ 'published_at' => 'desc' ])
67 67
             ->limit($limit);
68 68
 
69 69
         return $this->selectWith($select);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         $select = $this->getSql()->select()
75 75
             ->join('articles', 'article_videos.article_uuid = articles.article_uuid')
76
-            ->where(['articles.slug' => $slug]);
76
+            ->where([ 'articles.slug' => $slug ]);
77 77
 
78 78
         return $this->selectWith($select)->current();
79 79
     }
Please login to merge, or discard this patch.
data/phinx/migrations/20160908142829_admin_users.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
 {
9 9
     public function up()
10 10
     {
11
-        $this->table('admin_users', ['id' => false, 'primary_key' => 'admin_user_uuid'])
12
-            ->addColumn('admin_user_uuid', 'binary', ['limit' => 16])
11
+        $this->table('admin_users', [ 'id' => false, 'primary_key' => 'admin_user_uuid' ])
12
+            ->addColumn('admin_user_uuid', 'binary', [ 'limit' => 16 ])
13 13
             ->addColumn('admin_user_id', 'text')
14 14
             ->addColumn('first_name', 'text')
15 15
             ->addColumn('last_name', 'text')
16
-            ->addColumn('introduction', 'text', ['null' => true])
17
-            ->addColumn('email', 'string', ['limit' => 128])
18
-            ->addColumn('password', 'char', ['limit' => 60])
19
-            ->addColumn('status', 'integer', ['default' => 0])// 0 => not active, 1 = active
20
-            ->addColumn('face_img', 'text', ['null' => true])
21
-            ->addColumn('profile_img', 'text', ['null' => true])
22
-            ->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
23
-            ->addColumn('last_login', 'datetime', ['null' => true])
24
-            ->addIndex(['email'], ['name' => 'email_INDEX'])
16
+            ->addColumn('introduction', 'text', [ 'null' => true ])
17
+            ->addColumn('email', 'string', [ 'limit' => 128 ])
18
+            ->addColumn('password', 'char', [ 'limit' => 60 ])
19
+            ->addColumn('status', 'integer', [ 'default' => 0 ])// 0 => not active, 1 = active
20
+            ->addColumn('face_img', 'text', [ 'null' => true ])
21
+            ->addColumn('profile_img', 'text', [ 'null' => true ])
22
+            ->addColumn('created_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ])
23
+            ->addColumn('last_login', 'datetime', [ 'null' => true ])
24
+            ->addIndex([ 'email' ], [ 'name' => 'email_INDEX' ])
25 25
             ->create();
26 26
 
27 27
         $faker = Faker\Factory::create();
Please login to merge, or discard this patch.
data/phinx/migrations/20161003183353_articles.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,21 +6,21 @@
 block discarded – undo
6 6
 {
7 7
     public function up()
8 8
     {
9
-        $this->table('articles', ['id' => false, 'primary_key' => 'article_uuid'])
10
-            ->addColumn('article_uuid', 'binary', ['limit' => 16])
9
+        $this->table('articles', [ 'id' => false, 'primary_key' => 'article_uuid' ])
10
+            ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ])
11 11
             ->addColumn('article_id', 'text')
12
-            ->addColumn('slug', 'text', ['null' => true])
13
-            ->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
14
-            ->addColumn('published_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
12
+            ->addColumn('slug', 'text', [ 'null' => true ])
13
+            ->addColumn('created_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ])
14
+            ->addColumn('published_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ])
15 15
             ->addColumn('type', 'integer')// see Core\Entity\ArticleType
16 16
             ->addColumn('status', 'integer')// active, not active, ...
17
-            ->addColumn('admin_user_uuid', 'binary', ['limit' => 16])
18
-            ->addColumn('is_wysiwyg_editor', 'boolean', ['default' => false])
19
-            ->addColumn('category_uuid', 'binary', ['limit' => 16])
20
-            ->addForeignKey('category_uuid', 'category', 'category_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
21
-            ->addForeignKey('admin_user_uuid', 'admin_users', 'admin_user_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
22
-            ->addIndex('type', ['name' => 'type_INDEX'])
23
-            ->addIndex('published_at', ['name' => 'published_at_INDEX'])
17
+            ->addColumn('admin_user_uuid', 'binary', [ 'limit' => 16 ])
18
+            ->addColumn('is_wysiwyg_editor', 'boolean', [ 'default' => false ])
19
+            ->addColumn('category_uuid', 'binary', [ 'limit' => 16 ])
20
+            ->addForeignKey('category_uuid', 'category', 'category_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
21
+            ->addForeignKey('admin_user_uuid', 'admin_users', 'admin_user_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
22
+            ->addIndex('type', [ 'name' => 'type_INDEX' ])
23
+            ->addIndex('published_at', [ 'name' => 'published_at_INDEX' ])
24 24
             ->create();
25 25
     }
26 26
 
Please login to merge, or discard this patch.