Passed
Push — 5.1 ( 1be377...189c0c )
by liu
07:26
created
library/think/model/relation/HasOne.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         }
89 89
 
90 90
         return $this->query
91
-            ->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
91
+            ->whereExp($this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey)
92 92
             ->fetchSql()
93 93
             ->$aggregate($field);
94 94
     }
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
 
144 144
         return $this->parent->db()
145 145
             ->alias($model)
146
-            ->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) {
146
+            ->whereExists(function($query) use ($table, $model, $relation, $localKey, $foreignKey) {
147 147
                 $query->table([$table => $relation])
148
-                    ->field($relation . '.' . $foreignKey)
149
-                    ->whereExp($model . '.' . $localKey, '=' . $relation . '.' . $foreignKey)
150
-                    ->when($softDelete, function ($query) use ($softDelete, $relation) {
151
-                        $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
148
+                    ->field($relation.'.'.$foreignKey)
149
+                    ->whereExp($model.'.'.$localKey, '='.$relation.'.'.$foreignKey)
150
+                    ->when($softDelete, function($query) use ($softDelete, $relation) {
151
+                        $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
152 152
                     });
153 153
             });
154 154
     }
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
         return $this->parent->db()
177 177
             ->alias($model)
178 178
             ->field($fields)
179
-            ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $this->joinType)
180
-            ->when($softDelete, function ($query) use ($softDelete, $relation) {
181
-                $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
179
+            ->join([$table => $relation], $model.'.'.$this->localKey.'='.$relation.'.'.$this->foreignKey, $this->joinType)
180
+            ->when($softDelete, function($query) use ($softDelete, $relation) {
181
+                $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
182 182
             })
183 183
             ->where($where);
184 184
     }
Please login to merge, or discard this patch.
library/think/model/relation/HasManyThrough.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
         $softDelete    = $this->query->getOptions('soft_delete');
90 90
 
91 91
         if ('*' != $id) {
92
-            $id = $relationTable . '.' . $relation->getPk();
92
+            $id = $relationTable.'.'.$relation->getPk();
93 93
         }
94 94
 
95 95
         return $this->parent->db()
96 96
             ->alias($model)
97
-            ->field($model . '.*')
98
-            ->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey)
99
-            ->join($relationTable, $relationTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk)
100
-            ->when($softDelete, function ($query) use ($softDelete, $relationTable) {
101
-                $query->where($relationTable . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
97
+            ->field($model.'.*')
98
+            ->join($throughTable, $throughTable.'.'.$this->foreignKey.'='.$model.'.'.$this->localKey)
99
+            ->join($relationTable, $relationTable.'.'.$throughKey.'='.$throughTable.'.'.$this->throughPk)
100
+            ->when($softDelete, function($query) use ($softDelete, $relationTable) {
101
+                $query->where($relationTable.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
102 102
             })
103
-            ->group($relationTable . '.' . $this->throughKey)
104
-            ->having('count(' . $id . ')' . $operator . $count);
103
+            ->group($relationTable.'.'.$this->throughKey)
104
+            ->having('count('.$id.')'.$operator.$count);
105 105
     }
106 106
 
107 107
     /**
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
 
129 129
         return $this->parent->db()
130 130
             ->alias($model)
131
-            ->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey)
132
-            ->join($modelTable, $modelTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk)
133
-            ->when($softDelete, function ($query) use ($softDelete, $relationTable) {
134
-                $query->where($relationTable . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
131
+            ->join($throughTable, $throughTable.'.'.$this->foreignKey.'='.$model.'.'.$this->localKey)
132
+            ->join($modelTable, $modelTable.'.'.$throughKey.'='.$throughTable.'.'.$this->throughPk)
133
+            ->when($softDelete, function($query) use ($softDelete, $relationTable) {
134
+                $query->where($relationTable.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
135 135
             })
136
-            ->group($modelTable . '.' . $this->throughKey)
136
+            ->group($modelTable.'.'.$this->throughKey)
137 137
             ->where($where)
138 138
             ->field($fields);
139 139
     }
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
         $modelTable   = $this->parent->getTable();
286 286
 
287 287
         if (false === strpos($field, '.')) {
288
-            $field = $alias . '.' . $field;
288
+            $field = $alias.'.'.$field;
289 289
         }
290 290
 
291 291
         return $this->query
292 292
             ->alias($alias)
293
-            ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey)
294
-            ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey)
295
-            ->where($throughTable . '.' . $this->foreignKey, $result->$localKey)
293
+            ->join($throughTable, $throughTable.'.'.$pk.'='.$alias.'.'.$throughKey)
294
+            ->join($modelTable, $modelTable.'.'.$this->localKey.'='.$throughTable.'.'.$this->foreignKey)
295
+            ->where($throughTable.'.'.$this->foreignKey, $result->$localKey)
296 296
             ->$aggregate($field);
297 297
     }
298 298
 
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
         $modelTable   = $this->parent->getTable();
322 322
 
323 323
         if (false === strpos($field, '.')) {
324
-            $field = $alias . '.' . $field;
324
+            $field = $alias.'.'.$field;
325 325
         }
326 326
 
327 327
         return $this->query
328 328
             ->alias($alias)
329
-            ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey)
330
-            ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey)
331
-            ->whereExp($throughTable . '.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
329
+            ->join($throughTable, $throughTable.'.'.$pk.'='.$alias.'.'.$throughKey)
330
+            ->join($modelTable, $modelTable.'.'.$this->localKey.'='.$throughTable.'.'.$this->foreignKey)
331
+            ->whereExp($throughTable.'.'.$this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey)
332 332
             ->fetchSql()
333 333
             ->$aggregate($field);
334 334
     }
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
             $this->query
352 352
                 ->field($fields)
353 353
                 ->alias($alias)
354
-                ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey)
355
-                ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey)
356
-                ->where($throughTable . '.' . $this->foreignKey, $this->parent->{$this->localKey});
354
+                ->join($throughTable, $throughTable.'.'.$pk.'='.$alias.'.'.$throughKey)
355
+                ->join($modelTable, $modelTable.'.'.$this->localKey.'='.$throughTable.'.'.$this->foreignKey)
356
+                ->where($throughTable.'.'.$this->foreignKey, $this->parent->{$this->localKey});
357 357
 
358 358
             $this->baseQuery = true;
359 359
         }
Please login to merge, or discard this patch.
library/think/model/relation/HasMany.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
             }
195 195
         }
196 196
 
197
-        return $this->query->alias($aggregate . '_table')
198
-            ->whereExp($aggregate . '_table.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
197
+        return $this->query->alias($aggregate.'_table')
198
+            ->whereExp($aggregate.'_table.'.$this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey)
199 199
             ->fetchSql()
200 200
             ->$aggregate($field);
201 201
     }
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 
300 300
         return $this->parent->db()
301 301
             ->alias($model)
302
-            ->field($model . '.*')
303
-            ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType)
304
-            ->when($softDelete, function ($query) use ($softDelete, $relation) {
305
-                $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
302
+            ->field($model.'.*')
303
+            ->join([$table => $relation], $model.'.'.$this->localKey.'='.$relation.'.'.$this->foreignKey, $joinType)
304
+            ->when($softDelete, function($query) use ($softDelete, $relation) {
305
+                $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
306 306
             })
307
-            ->group($relation . '.' . $this->foreignKey)
308
-            ->having('count(' . $id . ')' . $operator . $count);
307
+            ->group($relation.'.'.$this->foreignKey)
308
+            ->having('count('.$id.')'.$operator.$count);
309 309
     }
310 310
 
311 311
     /**
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 
331 331
         return $this->parent->db()
332 332
             ->alias($model)
333
-            ->group($model . '.' . $this->localKey)
333
+            ->group($model.'.'.$this->localKey)
334 334
             ->field($fields)
335
-            ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey)
336
-            ->when($softDelete, function ($query) use ($softDelete, $relation) {
337
-                $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
335
+            ->join([$table => $relation], $model.'.'.$this->localKey.'='.$relation.'.'.$this->foreignKey)
336
+            ->when($softDelete, function($query) use ($softDelete, $relation) {
337
+                $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
338 338
             })
339 339
             ->where($where);
340 340
     }
Please login to merge, or discard this patch.
library/think/model/relation/BelongsTo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         }
89 89
 
90 90
         return $this->query
91
-            ->whereExp($this->localKey, '=' . $this->parent->getTable() . '.' . $this->foreignKey)
91
+            ->whereExp($this->localKey, '='.$this->parent->getTable().'.'.$this->foreignKey)
92 92
             ->fetchSql()
93 93
             ->$aggregate($field);
94 94
     }
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 
145 145
         return $this->parent->db()
146 146
             ->alias($model)
147
-            ->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) {
147
+            ->whereExists(function($query) use ($table, $model, $relation, $localKey, $foreignKey) {
148 148
                 $query->table([$table => $relation])
149
-                    ->field($relation . '.' . $localKey)
150
-                    ->whereExp($model . '.' . $foreignKey, '=' . $relation . '.' . $localKey)
151
-                    ->when($softDelete, function ($query) use ($softDelete, $relation) {
152
-                        $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
149
+                    ->field($relation.'.'.$localKey)
150
+                    ->whereExp($model.'.'.$foreignKey, '='.$relation.'.'.$localKey)
151
+                    ->when($softDelete, function($query) use ($softDelete, $relation) {
152
+                        $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
153 153
                     });
154 154
             });
155 155
     }
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
         return $this->parent->db()
178 178
             ->alias($model)
179 179
             ->field($fields)
180
-            ->join([$table => $relation], $model . '.' . $this->foreignKey . '=' . $relation . '.' . $this->localKey, $this->joinType)
181
-            ->when($softDelete, function ($query) use ($softDelete, $relation) {
182
-                $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
180
+            ->join([$table => $relation], $model.'.'.$this->foreignKey.'='.$relation.'.'.$this->localKey, $this->joinType)
181
+            ->when($softDelete, function($query) use ($softDelete, $relation) {
182
+                $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
183 183
             })
184 184
             ->where($where);
185 185
     }
Please login to merge, or discard this patch.