Completed
Branch dev_2x (79898e)
by Adrian
09:26
created
src/Mapper.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -159,10 +159,10 @@
 block discarded – undo
159 159
     public function newEntity(array $data): EntityInterface
160 160
     {
161 161
         $entity = $this->getHydrator()
162
-                       ->hydrate(array_merge(
163
-                           $this->getConfig()->getDefaultEntityAttributes(),
164
-                           $data
165
-                       ));
162
+                        ->hydrate(array_merge(
163
+                            $this->getConfig()->getDefaultEntityAttributes(),
164
+                            $data
165
+                        ));
166 166
 
167 167
         return $this->behaviours->apply($this, __FUNCTION__, $entity);
168 168
     }
Please login to merge, or discard this patch.
src/Definition/Column.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -65,86 +65,86 @@
 block discarded – undo
65 65
     public static function varchar(string $name, $length = 255)
66 66
     {
67 67
         return static::make($name)
68
-                     ->setType(static::TYPE_VARCHAR)
69
-                     ->setLength($length);
68
+                        ->setType(static::TYPE_VARCHAR)
69
+                        ->setLength($length);
70 70
     }
71 71
 
72 72
     public static function bool(string $name)
73 73
     {
74 74
         return static::make($name)
75
-                     ->setType(static::TYPE_BOOLEAN);
75
+                        ->setType(static::TYPE_BOOLEAN);
76 76
     }
77 77
 
78 78
     public static function string(string $name)
79 79
     {
80 80
         return static::make($name)
81
-                     ->setType(static::TYPE_TEXT);
81
+                        ->setType(static::TYPE_TEXT);
82 82
     }
83 83
 
84 84
     public static function datetime(string $name)
85 85
     {
86 86
         return static::make($name)
87
-                     ->setType(static::TYPE_DATETIME);
87
+                        ->setType(static::TYPE_DATETIME);
88 88
     }
89 89
 
90 90
     public static function date(string $name)
91 91
     {
92 92
         return static::make($name)
93
-                     ->setType(static::TYPE_DATE);
93
+                        ->setType(static::TYPE_DATE);
94 94
     }
95 95
 
96 96
     public static function timestamp(string $name)
97 97
     {
98 98
         return static::make($name)
99
-                     ->setType(static::TYPE_TIMESTAMP);
99
+                        ->setType(static::TYPE_TIMESTAMP);
100 100
     }
101 101
 
102 102
     public static function json(string $name)
103 103
     {
104 104
         return static::make($name)
105
-                     ->setType(static::TYPE_JSON);
105
+                        ->setType(static::TYPE_JSON);
106 106
     }
107 107
 
108 108
     public static function float(string $name)
109 109
     {
110 110
         return static::make($name)
111
-                     ->setType(static::TYPE_FLOAT);
111
+                        ->setType(static::TYPE_FLOAT);
112 112
     }
113 113
 
114 114
     public static function integer(string $name, $unsigned = false)
115 115
     {
116 116
         return static::make($name)
117
-                     ->setType(static::TYPE_INTEGER)
118
-                     ->setUnsigned($unsigned);
117
+                        ->setType(static::TYPE_INTEGER)
118
+                        ->setUnsigned($unsigned);
119 119
     }
120 120
 
121 121
     public static function tinyInteger(string $name, $unsigned = false)
122 122
     {
123 123
         return static::make($name)
124
-                     ->setType(static::TYPE_TINY_INTEGER)
125
-                     ->setUnsigned($unsigned);
124
+                        ->setType(static::TYPE_TINY_INTEGER)
125
+                        ->setUnsigned($unsigned);
126 126
     }
127 127
 
128 128
     public static function smallInteger(string $name, $unsigned = false)
129 129
     {
130 130
         return static::make($name)
131
-                     ->setType(static::TYPE_SMALL_INTEGER)
132
-                     ->setUnsigned($unsigned);
131
+                        ->setType(static::TYPE_SMALL_INTEGER)
132
+                        ->setUnsigned($unsigned);
133 133
     }
134 134
 
135 135
     public static function bigInteger(string $name, $unsigned = false)
136 136
     {
137 137
         return static::make($name)
138
-                     ->setType(static::TYPE_BIG_INTEGER)
139
-                     ->setUnsigned($unsigned);
138
+                        ->setType(static::TYPE_BIG_INTEGER)
139
+                        ->setUnsigned($unsigned);
140 140
     }
141 141
 
142 142
     public static function decimal(string $name, int $digits, int $precision)
143 143
     {
144 144
         return static::make($name)
145
-                     ->setType(static::TYPE_DECIMAL)
146
-                     ->setDigits($digits)
147
-                     ->setPrecision($precision);
145
+                        ->setType(static::TYPE_DECIMAL)
146
+                        ->setDigits($digits)
147
+                        ->setPrecision($precision);
148 148
     }
149 149
 
150 150
 
Please login to merge, or discard this patch.
src/Definition/Mapper.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -363,7 +363,7 @@
 block discarded – undo
363 363
     {
364 364
         return $this->addColumn(
365 365
             Column::integer('id', true)
366
-                  ->setAutoIncrement(true)
366
+                    ->setAutoIncrement(true)
367 367
         );
368 368
     }
369 369
 
Please login to merge, or discard this patch.
src/Definition/Behaviour/SoftDelete.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         if ($this->deletedAtColumn && ! array_key_exists($this->deletedAtColumn, $columns)) {
48 48
             $mapper->addColumn(Column::datetime($this->deletedAtColumn)
49
-                                     ->setNullable(true));
49
+                                        ->setNullable(true));
50 50
         }
51 51
 
52 52
         return $this;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $class->getNamespace()->addUse(\Sirius\Orm\Action\Delete::class, 'DeleteAction');
59 59
         $class->getNamespace()->addUse(\Sirius\Orm\Action\Update::class, 'UpdateAction');
60 60
         $class->addProperty('deletedAtColumn', $this->deletedAtColumn)
61
-              ->setVisibility('protected');
61
+                ->setVisibility('protected');
62 62
 
63 63
         //
64 64
         $method = $class->addMethod('newDeleteAction');
@@ -123,21 +123,21 @@  discard block
 block discarded – undo
123 123
     public function observeBaseQueryClass(ClassType $class): ClassType
124 124
     {
125 125
         $class->addProperty('deletedAtColumn', $this->deletedAtColumn)
126
-              ->setVisibility('protected');
126
+                ->setVisibility('protected');
127 127
 
128 128
         // add guard
129 129
         if ( ! $class->hasMethod('init')) {
130 130
             $class->addMethod('init')
131
-                  ->setVisibility(ClassType::VISIBILITY_PROTECTED)
132
-                  ->setBody('parent::init();' . PHP_EOL);
131
+                    ->setVisibility(ClassType::VISIBILITY_PROTECTED)
132
+                    ->setBody('parent::init();' . PHP_EOL);
133 133
         }
134 134
         $init = $class->getMethod('init');
135 135
         $init->addBody('$this->guards[] = $this->deletedAtColumn . \' IS NULL\';' . PHP_EOL);
136 136
 
137 137
         // add withTrashed()
138 138
         $class->addMethod('withTrashed')
139
-              ->setVisibility(ClassType::VISIBILITY_PUBLIC)
140
-              ->setBody('
139
+                ->setVisibility(ClassType::VISIBILITY_PUBLIC)
140
+                ->setBody('
141 141
 $guards = [];
142 142
 foreach ($this->guards as $k => $v) {
143 143
     if ($v != $this->deletedAtColumn . \' IS NULL\') {
Please login to merge, or discard this patch.
src/Definition/Behaviour/Timestamps.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
     static public function make($createdAtColumn = 'created_at', $updatedAtColumn = 'updated_at')
20 20
     {
21 21
         return parent::make()
22
-                     ->setCreatedAtColumn($createdAtColumn)
23
-                     ->setUpdatedAtColumn($updatedAtColumn);
22
+                        ->setCreatedAtColumn($createdAtColumn)
23
+                        ->setUpdatedAtColumn($updatedAtColumn);
24 24
     }
25 25
 
26 26
     function getName(): string
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 
61 61
         if ($this->createdAtColumn && ! array_key_exists($this->createdAtColumn, $columns)) {
62 62
             $mapper->addColumn(Column::datetime($this->createdAtColumn)
63
-                                     ->setNullable(true));
63
+                                        ->setNullable(true));
64 64
         }
65 65
 
66 66
         if ($this->updatedAtColumn && ! array_key_exists($this->updatedAtColumn, $columns)) {
67 67
             $mapper->addColumn(Column::datetime($this->updatedAtColumn)
68
-                                     ->setNullable(true)
69
-                                     ->setAfter($this->createdAtColumn));
68
+                                        ->setNullable(true)
69
+                                        ->setAfter($this->createdAtColumn));
70 70
         }
71 71
 
72 72
         return $this;
@@ -75,35 +75,35 @@  discard block
 block discarded – undo
75 75
     public function observeBaseQueryClass(ClassType $class): ClassType
76 76
     {
77 77
         $class->addProperty('createdAtColumn', $this->createdAtColumn)
78
-              ->setVisibility('protected');
78
+                ->setVisibility('protected');
79 79
         $class->addProperty('updatedAtColumn', $this->updatedAtColumn)
80
-              ->setVisibility('protected');
80
+                ->setVisibility('protected');
81 81
 
82 82
         // add methods
83 83
         $class->addMethod('orderByFirstCreated')
84
-              ->setVisibility('public')
85
-              ->setBody('
84
+                ->setVisibility('public')
85
+                ->setBody('
86 86
 $this->orderBy($this->createdAtColumn . \' ASC\');
87 87
 
88 88
 return $this;            
89 89
             ');
90 90
         $class->addMethod('orderByLastCreated')
91
-              ->setVisibility('public')
92
-              ->setBody('
91
+                ->setVisibility('public')
92
+                ->setBody('
93 93
 $this->orderBy($this->createdAtColumn . \' DESC\');
94 94
 
95 95
 return $this;            
96 96
             ');
97 97
         $class->addMethod('orderByFirstUpdated')
98
-              ->setVisibility('public')
99
-              ->setBody('
98
+                ->setVisibility('public')
99
+                ->setBody('
100 100
 $this->orderBy($this->updatedAtColumn . \' ASC\');
101 101
 
102 102
 return $this;            
103 103
             ');
104 104
         $class->addMethod('orderByLastCreated')
105
-              ->setVisibility('public')
106
-              ->setBody('
105
+                ->setVisibility('public')
106
+                ->setBody('
107 107
 $this->orderBy($this->updatedAtColumn . \' DESC\');
108 108
 
109 109
 return $this;            
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         if ( ! $class->hasMethod('init')) {
121 121
             $class->addMethod('init')->setVisibility('public')
122
-                  ->setBody('parent::init();' . PHP_EOL);
122
+                    ->setBody('parent::init();' . PHP_EOL);
123 123
         }
124 124
         $class->getNamespace()->addUse(\Sirius\Orm\Behaviour\Timestamps::class);
125 125
         $method = $class->getMethod('init');
Please login to merge, or discard this patch.
src/Action/Insert.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
         $insertSql = new \Sirius\Sql\Insert($connection);
31 31
         $insertSql->into($this->mapper->getConfig()->getTable())
32
-                  ->columns($columns);
32
+                    ->columns($columns);
33 33
         $insertSql->perform();
34 34
 
35 35
         /**
Please login to merge, or discard this patch.
src/Action/SoftDelete.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 
24 24
         $update = new \Sirius\Sql\Update($this->mapper->getWriteConnection());
25 25
         $update->table($this->mapper->getConfig()->getTable())
26
-               ->columns([
27
-                   $this->getOption('deleted_at_column') => $this->now
28
-               ])
29
-               ->where('id', $entityId);
26
+                ->columns([
27
+                    $this->getOption('deleted_at_column') => $this->now
28
+                ])
29
+                ->where('id', $entityId);
30 30
         $update->perform();
31 31
     }
32 32
 
Please login to merge, or discard this patch.
src/Action/AttachEntities.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,8 +122,8 @@
 block discarded – undo
122 122
 
123 123
         $insert = new \Sirius\Sql\Insert($conn);
124 124
         $insert->into($throughTable)
125
-               ->columns($insertColumns)
126
-               ->perform();
125
+                ->columns($insertColumns)
126
+                ->perform();
127 127
     }
128 128
 
129 129
     protected function getNativeEntityHydrator()
Please login to merge, or discard this patch.
src/Action/Update.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@
 block discarded – undo
54 54
         if (count($columns) > 0) {
55 55
             $updateSql = new \Sirius\Sql\Update($connection);
56 56
             $updateSql->table($this->mapper->getConfig()->getTable())
57
-                      ->columns($columns)
58
-                      ->whereAll($conditions, false);
57
+                        ->columns($columns)
58
+                        ->whereAll($conditions, false);
59 59
             $updateSql->perform();
60 60
         }
61 61
     }
Please login to merge, or discard this patch.