Passed
Pull Request — 5.1 (#2169)
by
unknown
07:32
created
library/think/model/relation/HasOne.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         }
90 90
 
91 91
         return $this->query
92
-            ->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
92
+            ->whereExp($this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey)
93 93
             ->fetchSql()
94 94
             ->$aggregate($field);
95 95
     }
@@ -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, $softDelete) {
147
+            ->whereExists(function($query) use ($table, $model, $relation, $localKey, $foreignKey, $softDelete) {
148 148
                 $query->table([$table => $relation])
149
-                    ->field($relation . '.' . $foreignKey)
150
-                    ->whereExp($model . '.' . $localKey, '=' . $relation . '.' . $foreignKey)
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.'.'.$foreignKey)
150
+                    ->whereExp($model.'.'.$localKey, '='.$relation.'.'.$foreignKey)
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->localKey . '=' . $relation . '.' . $this->foreignKey, $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->localKey.'='.$relation.'.'.$this->foreignKey, $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.