@@ -202,7 +202,7 @@ |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | $call = [$class, $method]; |
205 | - $class = $class . '->' . $method; |
|
205 | + $class = $class.'->'.$method; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | $result = $this->app->invoke($call, [$params]); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | function parse_name($name, $type = 0, $ucfirst = true) |
484 | 484 | { |
485 | 485 | if ($type) { |
486 | - $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) { |
|
486 | + $name = preg_replace_callback('/_([a-zA-Z])/', function($match) { |
|
487 | 487 | return strtoupper($match[1]); |
488 | 488 | }, $name); |
489 | 489 | |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | { |
595 | 595 | $token = Request::token($name, $type); |
596 | 596 | |
597 | - return '<input type="hidden" name="' . $name . '" value="' . $token . '" />'; |
|
597 | + return '<input type="hidden" name="'.$name.'" value="'.$token.'" />'; |
|
598 | 598 | } |
599 | 599 | } |
600 | 600 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); |
25 | 25 | } |
26 | 26 | |
27 | - $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); |
|
27 | + $error = sprintf('The command "%s" failed.'."\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); |
|
28 | 28 | |
29 | 29 | if (!$process->isOutputDisabled()) { |
30 | 30 | $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput()); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | protected function initialize() |
32 | 32 | { |
33 | 33 | // Point类型支持 |
34 | - Query::extend('point', function ($query, $field, $value = null, $fun = 'GeomFromText', $type = 'POINT') { |
|
34 | + Query::extend('point', function($query, $field, $value = null, $fun = 'GeomFromText', $type = 'POINT') { |
|
35 | 35 | if (!is_null($value)) { |
36 | 36 | $query->data($field, ['point', $value, $fun, $type]); |
37 | 37 | } else { |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | protected function parseDsn($config) |
55 | 55 | { |
56 | 56 | if (!empty($config['socket'])) { |
57 | - $dsn = 'mysql:unix_socket=' . $config['socket']; |
|
57 | + $dsn = 'mysql:unix_socket='.$config['socket']; |
|
58 | 58 | } elseif (!empty($config['hostport'])) { |
59 | - $dsn = 'mysql:host=' . $config['hostname'] . ';port=' . $config['hostport']; |
|
59 | + $dsn = 'mysql:host='.$config['hostname'].';port='.$config['hostport']; |
|
60 | 60 | } else { |
61 | - $dsn = 'mysql:host=' . $config['hostname']; |
|
61 | + $dsn = 'mysql:host='.$config['hostname']; |
|
62 | 62 | } |
63 | - $dsn .= ';dbname=' . $config['database']; |
|
63 | + $dsn .= ';dbname='.$config['database']; |
|
64 | 64 | |
65 | 65 | if (!empty($config['charset'])) { |
66 | - $dsn .= ';charset=' . $config['charset']; |
|
66 | + $dsn .= ';charset='.$config['charset']; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return $dsn; |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | if (strpos($tableName, '.')) { |
84 | 84 | $tableName = str_replace('.', '`.`', $tableName); |
85 | 85 | } |
86 | - $tableName = '`' . $tableName . '`'; |
|
86 | + $tableName = '`'.$tableName.'`'; |
|
87 | 87 | } |
88 | 88 | |
89 | - $sql = 'SHOW COLUMNS FROM ' . $tableName; |
|
89 | + $sql = 'SHOW COLUMNS FROM '.$tableName; |
|
90 | 90 | $pdo = $this->query($sql, [], false, true); |
91 | 91 | $result = $pdo->fetchAll(PDO::FETCH_ASSOC); |
92 | 92 | $info = []; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getTables($dbName = '') |
118 | 118 | { |
119 | - $sql = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES '; |
|
119 | + $sql = !empty($dbName) ? 'SHOW TABLES FROM '.$dbName : 'SHOW TABLES '; |
|
120 | 120 | $pdo = $this->query($sql, [], false, true); |
121 | 121 | $result = $pdo->fetchAll(PDO::FETCH_ASSOC); |
122 | 122 | $info = []; |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected function getExplain($sql) |
138 | 138 | { |
139 | - $pdo = $this->linkID->prepare("EXPLAIN " . $this->queryStr); |
|
139 | + $pdo = $this->linkID->prepare("EXPLAIN ".$this->queryStr); |
|
140 | 140 | |
141 | 141 | foreach ($this->bind as $key => $val) { |
142 | 142 | // 占位符 |
143 | - $param = is_int($key) ? $key + 1 : ':' . $key; |
|
143 | + $param = is_int($key) ? $key + 1 : ':'.$key; |
|
144 | 144 | |
145 | 145 | if (is_array($val)) { |
146 | 146 | if (PDO::PARAM_INT == $val[1] && '' === $val[0]) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | if (isset($result['extra'])) { |
164 | 164 | if (strpos($result['extra'], 'filesort') || strpos($result['extra'], 'temporary')) { |
165 | - $this->log('SQL:' . $this->queryStr . '[' . $result['extra'] . ']', 'warn'); |
|
165 | + $this->log('SQL:'.$this->queryStr.'['.$result['extra'].']', 'warn'); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 |
@@ -88,7 +88,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -194,8 +194,8 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -88,7 +88,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | if (empty($this->config['path'])) { |
43 | - $this->config['path'] = $this->app->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR; |
|
43 | + $this->config['path'] = $this->app->getRuntimePath().'log'.DIRECTORY_SEPARATOR; |
|
44 | 44 | } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { |
45 | 45 | $this->config['path'] .= DIRECTORY_SEPARATOR; |
46 | 46 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $msg = var_export($msg, true); |
70 | 70 | } |
71 | 71 | |
72 | - $info[$type][] = $this->config['json'] ? $msg : '[ ' . $type . ' ] ' . $msg; |
|
72 | + $info[$type][] = $this->config['json'] ? $msg : '[ '.$type.' ] '.$msg; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if (!$this->config['json'] && (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level']))) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | protected function getMasterLogFile() |
137 | 137 | { |
138 | 138 | if ($this->config['max_files']) { |
139 | - $files = glob($this->config['path'] . '*.log'); |
|
139 | + $files = glob($this->config['path'].'*.log'); |
|
140 | 140 | |
141 | 141 | try { |
142 | 142 | if (count($files) > $this->config['max_files']) { |
@@ -151,15 +151,15 @@ discard block |
||
151 | 151 | if ($this->config['single']) { |
152 | 152 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
153 | 153 | |
154 | - $destination = $this->config['path'] . $name . $cli . '.log'; |
|
154 | + $destination = $this->config['path'].$name.$cli.'.log'; |
|
155 | 155 | } else { |
156 | 156 | if ($this->config['max_files']) { |
157 | - $filename = date('Ymd') . $cli . '.log'; |
|
157 | + $filename = date('Ymd').$cli.'.log'; |
|
158 | 158 | } else { |
159 | - $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . $cli . '.log'; |
|
159 | + $filename = date('Ym').DIRECTORY_SEPARATOR.date('d').$cli.'.log'; |
|
160 | 160 | } |
161 | 161 | |
162 | - $destination = $this->config['path'] . $filename; |
|
162 | + $destination = $this->config['path'].$filename; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return $destination; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $name = date('d'); |
185 | 185 | } |
186 | 186 | |
187 | - return $path . DIRECTORY_SEPARATOR . $name . '_' . $type . $cli . '.log'; |
|
187 | + return $path.DIRECTORY_SEPARATOR.$name.'_'.$type.$cli.'.log'; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { |
199 | 199 | try { |
200 | - rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); |
|
200 | + rename($destination, dirname($destination).DIRECTORY_SEPARATOR.time().'-'.basename($destination)); |
|
201 | 201 | } catch (\Exception $e) { |
202 | 202 | } |
203 | 203 | } |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | protected function parseCliLog($info) |
213 | 213 | { |
214 | 214 | if ($this->config['json']) { |
215 | - $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
|
215 | + $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL; |
|
216 | 216 | } else { |
217 | 217 | $now = $info['timestamp']; |
218 | 218 | unset($info['timestamp']); |
219 | 219 | |
220 | 220 | $message = implode(PHP_EOL, $info); |
221 | 221 | |
222 | - $message = "[{$now}]" . $message . PHP_EOL; |
|
222 | + $message = "[{$now}]".$message.PHP_EOL; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | return $message; |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | |
243 | 243 | if ($this->config['json']) { |
244 | 244 | $info = $requestInfo + $info; |
245 | - return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
|
245 | + return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL; |
|
246 | 246 | } |
247 | 247 | |
248 | - array_unshift($info, "---------------------------------------------------------------" . PHP_EOL . "\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); |
|
248 | + array_unshift($info, "---------------------------------------------------------------".PHP_EOL."\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); |
|
249 | 249 | unset($info['timestamp']); |
250 | 250 | |
251 | - return implode(PHP_EOL, $info) . PHP_EOL; |
|
251 | + return implode(PHP_EOL, $info).PHP_EOL; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | protected function getDebugLog(&$info, $append, $apart) |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
264 | 264 | |
265 | 265 | $info = [ |
266 | - 'runtime' => number_format($runtime, 6) . 's', |
|
267 | - 'reqs' => $reqs . 'req/s', |
|
268 | - 'memory' => $memory_use . 'kb', |
|
266 | + 'runtime' => number_format($runtime, 6).'s', |
|
267 | + 'reqs' => $reqs.'req/s', |
|
268 | + 'memory' => $memory_use.'kb', |
|
269 | 269 | 'file' => count(get_included_files()), |
270 | 270 | ] + $info; |
271 | 271 | |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | |
277 | 277 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
278 | 278 | |
279 | - $time_str = '[运行时间:' . number_format($runtime, 6) . 's] [吞吐率:' . $reqs . 'req/s]'; |
|
280 | - $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; |
|
281 | - $file_load = ' [文件加载:' . count(get_included_files()) . ']'; |
|
279 | + $time_str = '[运行时间:'.number_format($runtime, 6).'s] [吞吐率:'.$reqs.'req/s]'; |
|
280 | + $memory_str = ' [内存消耗:'.$memory_use.'kb]'; |
|
281 | + $file_load = ' [文件加载:'.count(get_included_files()).']'; |
|
282 | 282 | |
283 | - array_unshift($info, $time_str . $memory_str . $file_load); |
|
283 | + array_unshift($info, $time_str.$memory_str.$file_load); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
@@ -89,19 +89,19 @@ discard block |
||
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 |
||
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, $modelTable) { |
|
134 | - $query->where($modelTable . 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, $modelTable) { |
|
134 | + $query->where($modelTable.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 |
||
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 |
||
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 |
||
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 | } |