@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function setPrimaryKey($column) : Table |
79 | 79 | { |
80 | 80 | if (!is_array($column)) { |
81 | - $column = [ $column ]; |
|
81 | + $column = [$column]; |
|
82 | 82 | } |
83 | 83 | $this->data['primary'] = $column; |
84 | 84 | return $this; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | if (!isset($name)) { |
168 | - $name = $toTable->getName() . '_' . implode('_', array_keys($keymap)); |
|
168 | + $name = $toTable->getName().'_'.implode('_', array_keys($keymap)); |
|
169 | 169 | } |
170 | 170 | $this->addRelation(new TableRelation( |
171 | 171 | $name, |
@@ -83,7 +83,7 @@ |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | if (!$this->statement->execute()) { |
86 | - throw new DBException('Prepared execute error: ' . $this->statement->error); |
|
86 | + throw new DBException('Prepared execute error: '.$this->statement->error); |
|
87 | 87 | } |
88 | 88 | return new Result($this->statement); |
89 | 89 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | } |
75 | 75 | public function next() |
76 | 76 | { |
77 | - $this->fetched ++; |
|
77 | + $this->fetched++; |
|
78 | 78 | $temp = \odbc_fetch_row($this->statement); |
79 | 79 | if (!$temp) { |
80 | 80 | $this->last = false; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $fields = []; |
71 | 71 | $exists = false; |
72 | 72 | foreach ($relation->table->getColumns() as $column) { |
73 | - $nm = $name . static::SEP . $column; |
|
73 | + $nm = $name.static::SEP.$column; |
|
74 | 74 | if (isset($this->aliases[$nm])) { |
75 | 75 | $nm = $this->aliases[$nm]; |
76 | 76 | } |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | $parts = explode(static::SEP, $name); |
85 | 85 | $name = array_pop($parts); |
86 | 86 | if (!$exists && !count($parts) && !isset($temp[$name])) { |
87 | - $temp[$name] = $relation->many ? [ '___clean' => true ] : null; |
|
87 | + $temp[$name] = $relation->many ? ['___clean' => true] : null; |
|
88 | 88 | } |
89 | 89 | if ($exists) { |
90 | - $full = ''; |
|
90 | + $full = ''; |
|
91 | 91 | foreach ($parts as $item) { |
92 | - $full = $full ? $full . static::SEP . $item : $item; |
|
92 | + $full = $full ? $full.static::SEP.$item : $item; |
|
93 | 93 | $temp = &$temp[$item]; |
94 | 94 | $rpk = []; |
95 | 95 | foreach ($this->relations[$full][0]->table->getPrimaryKey() as $pkey) { |
96 | - $nm = $full . static::SEP . $pkey; |
|
96 | + $nm = $full.static::SEP.$pkey; |
|
97 | 97 | if (isset($this->aliases[$nm])) { |
98 | 98 | $nm = $this->aliases[$nm]; |
99 | 99 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $temp = &$temp[json_encode($rpk)]; |
103 | 103 | } |
104 | 104 | if (!isset($temp[$name])) { |
105 | - $temp[$name] = $relation->many ? [ '___clean' => true ] : null; |
|
105 | + $temp[$name] = $relation->many ? ['___clean' => true] : null; |
|
106 | 106 | } |
107 | 107 | $temp = &$temp[$name]; |
108 | 108 | if ($relation->many) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | return; |
161 | 161 | } |
162 | 162 | } |
163 | - $this->fetched ++; |
|
163 | + $this->fetched++; |
|
164 | 164 | while ($this->result->valid()) { |
165 | 165 | $row = $this->result->current(); |
166 | 166 | $pk = []; |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $instance->setLength($data['length']); |
52 | 52 | } |
53 | 53 | if ($instance->getBasicType() === 'enum' && strpos($instance->getType(), 'enum(') === 0) { |
54 | - $temp = array_map(function ($v) { |
|
54 | + $temp = array_map(function($v) { |
|
55 | 55 | return str_replace("''", "'", $v); |
56 | 56 | }, explode("','", substr($instance->getType(), 6, -2))); |
57 | 57 | $instance->setValues($temp); |
@@ -24,28 +24,28 @@ |
||
24 | 24 | foreach ($data as $i => $v) { |
25 | 25 | switch (gettype($v)) { |
26 | 26 | case 'boolean': |
27 | - $this->statement->bindValue($i+1, $v, \PDO::PARAM_BOOL); |
|
27 | + $this->statement->bindValue($i + 1, $v, \PDO::PARAM_BOOL); |
|
28 | 28 | break; |
29 | 29 | case 'integer': |
30 | - $this->statement->bindValue($i+1, $v, \PDO::PARAM_INT); |
|
30 | + $this->statement->bindValue($i + 1, $v, \PDO::PARAM_INT); |
|
31 | 31 | break; |
32 | 32 | case 'NULL': |
33 | - $this->statement->bindValue($i+1, $v, \PDO::PARAM_NULL); |
|
33 | + $this->statement->bindValue($i + 1, $v, \PDO::PARAM_NULL); |
|
34 | 34 | break; |
35 | 35 | case 'double': |
36 | - $this->statement->bindValue($i+1, $v); |
|
36 | + $this->statement->bindValue($i + 1, $v); |
|
37 | 37 | break; |
38 | 38 | default: |
39 | 39 | // keep in mind oracle needs a transaction when inserting LOBs, aside from the specific syntax: |
40 | 40 | // INSERT INTO table (column, lobcolumn) VALUES (?, ?, EMPTY_BLOB()) RETURNING lobcolumn INTO ? |
41 | 41 | if (is_resource($v) && get_resource_type($v) === 'stream') { |
42 | - $this->statement->bindParam($i+1, $v, \PDO::PARAM_LOB); |
|
42 | + $this->statement->bindParam($i + 1, $v, \PDO::PARAM_LOB); |
|
43 | 43 | break; |
44 | 44 | } |
45 | 45 | if (!is_string($data[$i])) { |
46 | 46 | $data[$i] = serialize($data[$i]); |
47 | 47 | } |
48 | - $this->statement->bindValue($i+1, $v); |
|
48 | + $this->statement->bindValue($i + 1, $v); |
|
49 | 49 | break; |
50 | 50 | } |
51 | 51 | } |
@@ -75,8 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | $connection['name'] = $connectionString; |
77 | 77 | $connection['type'] = isset($aliases[$connection['type']]) ? |
78 | - $aliases[$connection['type']] : |
|
79 | - $connection['type']; |
|
78 | + $aliases[$connection['type']] : $connection['type']; |
|
80 | 79 | $tmp = '\\vakata\\database\\driver\\'.strtolower($connection['type']).'\\Driver'; |
81 | 80 | return new $tmp($connection); |
82 | 81 | } |
@@ -105,7 +104,7 @@ discard block |
||
105 | 104 | $new = ''; |
106 | 105 | $par = array_values($par); |
107 | 106 | if (substr_count($sql, '?') === 2 && !is_array($par[0])) { |
108 | - $par = [ $par ]; |
|
107 | + $par = [$par]; |
|
109 | 108 | } |
110 | 109 | $parts = explode('??', $sql); |
111 | 110 | $index = 0; |
@@ -115,7 +114,7 @@ discard block |
||
115 | 114 | $index += count($tmp) - 1; |
116 | 115 | if (isset($par[$index])) { |
117 | 116 | if (!is_array($par[$index])) { |
118 | - $par[$index] = [ $par[$index] ]; |
|
117 | + $par[$index] = [$par[$index]]; |
|
119 | 118 | } |
120 | 119 | $params = $par[$index]; |
121 | 120 | array_splice($par, $index, 1, $params); |
@@ -123,7 +122,7 @@ discard block |
||
123 | 122 | $new .= implode(',', array_fill(0, count($params), '?')); |
124 | 123 | } |
125 | 124 | } |
126 | - return [ $new, $par ]; |
|
125 | + return [$new, $par]; |
|
127 | 126 | } |
128 | 127 | /** |
129 | 128 | * Run a query (prepare & execute). |
@@ -155,7 +154,7 @@ discard block |
||
155 | 154 | { |
156 | 155 | $coll = Collection::from($this->query($sql, $par)); |
157 | 156 | if (($keys = $this->driver->option('mode')) && in_array($keys, ['strtoupper', 'strtolower'])) { |
158 | - $coll->map(function ($v) use ($keys) { |
|
157 | + $coll->map(function($v) use ($keys) { |
|
159 | 158 | $new = []; |
160 | 159 | foreach ($v as $k => $vv) { |
161 | 160 | $new[call_user_func($keys, $k)] = $vv; |
@@ -164,13 +163,13 @@ discard block |
||
164 | 163 | }); |
165 | 164 | } |
166 | 165 | if ($key !== null) { |
167 | - $coll->mapKey(function ($v) use ($key) { return $v[$key]; }); |
|
166 | + $coll->mapKey(function($v) use ($key) { return $v[$key]; }); |
|
168 | 167 | } |
169 | 168 | if ($skip) { |
170 | - $coll->map(function ($v) use ($key) { unset($v[$key]); return $v; }); |
|
169 | + $coll->map(function($v) use ($key) { unset($v[$key]); return $v; }); |
|
171 | 170 | } |
172 | 171 | if ($opti) { |
173 | - $coll->map(function ($v) { return count($v) === 1 ? current($v) : $v; }); |
|
172 | + $coll->map(function($v) { return count($v) === 1 ? current($v) : $v; }); |
|
174 | 173 | } |
175 | 174 | return $coll; |
176 | 175 | } |
@@ -254,8 +253,7 @@ discard block |
||
254 | 253 | public function definition(string $table, bool $detectRelations = true) : Table |
255 | 254 | { |
256 | 255 | return isset($this->tables[$table]) ? |
257 | - $this->tables[$table] : |
|
258 | - $this->driver->table($table, $detectRelations); |
|
256 | + $this->tables[$table] : $this->driver->table($table, $detectRelations); |
|
259 | 257 | } |
260 | 258 | /** |
261 | 259 | * Parse all tables from the database. |
@@ -272,12 +270,12 @@ discard block |
||
272 | 270 | */ |
273 | 271 | public function getSchema($asPlainArray = true) |
274 | 272 | { |
275 | - return !$asPlainArray ? $this->tables : array_map(function ($table) { |
|
273 | + return !$asPlainArray ? $this->tables : array_map(function($table) { |
|
276 | 274 | return [ |
277 | 275 | 'name' => $table->getName(), |
278 | 276 | 'pkey' => $table->getPrimaryKey(), |
279 | 277 | 'comment' => $table->getComment(), |
280 | - 'columns' => array_map(function ($column) { |
|
278 | + 'columns' => array_map(function($column) { |
|
281 | 279 | return [ |
282 | 280 | 'name' => $column->getName(), |
283 | 281 | 'type' => $column->getType(), |
@@ -288,13 +286,13 @@ discard block |
||
288 | 286 | 'nullable' => $column->isNullable() |
289 | 287 | ]; |
290 | 288 | }, $table->getFullColumns()), |
291 | - 'relations' => array_map(function ($rel) { |
|
289 | + 'relations' => array_map(function($rel) { |
|
292 | 290 | $relation = clone $rel; |
293 | 291 | $relation->table = $relation->table->getName(); |
294 | 292 | if ($relation->pivot) { |
295 | 293 | $relation->pivot = $relation->pivot->getName(); |
296 | 294 | } |
297 | - return (array)$relation; |
|
295 | + return (array) $relation; |
|
298 | 296 | }, $table->getRelations()) |
299 | 297 | ]; |
300 | 298 | }, $this->tables); |
@@ -342,8 +340,7 @@ discard block |
||
342 | 340 | public function table($table, bool $mapped = false) |
343 | 341 | { |
344 | 342 | return $mapped ? |
345 | - new TableQueryMapped($this, $this->definition($table)) : |
|
346 | - new TableQuery($this, $this->definition($table)); |
|
343 | + new TableQueryMapped($this, $this->definition($table)) : new TableQuery($this, $this->definition($table)); |
|
347 | 344 | } |
348 | 345 | public function __call($method, $args) |
349 | 346 | { |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | $columns = Collection::from($this |
139 | 139 | ->query( |
140 | 140 | "SELECT * FROM all_tab_cols WHERE table_name = ? AND owner = ?", |
141 | - [ strtoupper($table), $this->name() ] |
|
141 | + [strtoupper($table), $this->name()] |
|
142 | 142 | )) |
143 | - ->map(function ($v) { |
|
143 | + ->map(function($v) { |
|
144 | 144 | $new = []; |
145 | 145 | foreach ($v as $kk => $vv) { |
146 | 146 | $new[strtoupper($kk)] = $vv; |
147 | 147 | } |
148 | 148 | return $new; |
149 | 149 | }) |
150 | - ->mapKey(function ($v) { return $v['COLUMN_NAME']; }) |
|
151 | - ->map(function ($v) { |
|
150 | + ->mapKey(function($v) { return $v['COLUMN_NAME']; }) |
|
151 | + ->map(function($v) { |
|
152 | 152 | $v['length'] = null; |
153 | 153 | if (!isset($v['DATA_TYPE'])) { |
154 | 154 | return $v; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | default: |
161 | 161 | if (strpos($type, 'char') !== false && strpos($type, '(') !== false) { |
162 | 162 | // extract length from varchar |
163 | - $v['length'] = (int)explode(')', (explode('(', $type)[1] ?? ''))[0]; |
|
163 | + $v['length'] = (int) explode(')', (explode('(', $type)[1] ?? ''))[0]; |
|
164 | 164 | $v['length'] = $v['length'] > 0 ? $v['length'] : null; |
165 | 165 | } |
166 | 166 | break; |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | ->query( |
177 | 177 | "SELECT constraint_name FROM all_constraints |
178 | 178 | WHERE table_name = ? AND constraint_type = ? AND owner = ?", |
179 | - [ strtoupper($table), 'P', $owner ] |
|
179 | + [strtoupper($table), 'P', $owner] |
|
180 | 180 | )) |
181 | - ->map(function ($v) { |
|
181 | + ->map(function($v) { |
|
182 | 182 | $new = []; |
183 | 183 | foreach ($v as $kk => $vv) { |
184 | 184 | $new[strtoupper($kk)] = $vv; |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | ->query( |
194 | 194 | "SELECT column_name FROM all_cons_columns |
195 | 195 | WHERE table_name = ? AND constraint_name = ? AND owner = ?", |
196 | - [ strtoupper($table), $pkname, $owner ] |
|
196 | + [strtoupper($table), $pkname, $owner] |
|
197 | 197 | )) |
198 | - ->map(function ($v) { |
|
198 | + ->map(function($v) { |
|
199 | 199 | $new = []; |
200 | 200 | foreach ($v as $kk => $vv) { |
201 | 201 | $new[strtoupper($kk)] = $vv; |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | LEFT JOIN all_cons_columns cc ON cc.OWNER = ac.OWNER AND cc.CONSTRAINT_NAME = ac.CONSTRAINT_NAME |
223 | 223 | WHERE ac.OWNER = ? AND ac.R_OWNER = ? AND ac.R_CONSTRAINT_NAME = ? AND ac.CONSTRAINT_TYPE = ? |
224 | 224 | ORDER BY cc.POSITION", |
225 | - [ $owner, $owner, $pkname, 'R' ] |
|
225 | + [$owner, $owner, $pkname, 'R'] |
|
226 | 226 | )) |
227 | - ->map(function ($v) { |
|
227 | + ->map(function($v) { |
|
228 | 228 | $new = []; |
229 | 229 | foreach ($v as $kk => $vv) { |
230 | 230 | $new[strtoupper($kk)] = $vv; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | as $relation |
235 | 235 | ) { |
236 | 236 | $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_NAME']; |
237 | - $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int)$relation['POSITION']-1]] = $relation['COLUMN_NAME']; |
|
237 | + $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int) $relation['POSITION'] - 1]] = $relation['COLUMN_NAME']; |
|
238 | 238 | } |
239 | 239 | foreach ($relations as $data) { |
240 | 240 | $rtable = $this->table($data['table'], true); |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | ac.OWNER = ? AND ac.R_OWNER = ? AND ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ? AND |
259 | 259 | cc.COLUMN_NAME IN (??) |
260 | 260 | ORDER BY POSITION", |
261 | - [ $owner, $owner, $data['table'], 'R', $columns ] |
|
261 | + [$owner, $owner, $data['table'], 'R', $columns] |
|
262 | 262 | )) |
263 | - ->map(function ($v) { |
|
263 | + ->map(function($v) { |
|
264 | 264 | $new = []; |
265 | 265 | foreach ($v as $kk => $vv) { |
266 | 266 | $new[strtoupper($kk)] = $vv; |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | $rcolumns = Collection::from($this |
279 | 279 | ->query( |
280 | 280 | "SELECT COLUMN_NAME FROM all_cons_columns WHERE OWNER = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION", |
281 | - [ $owner, current($foreign['keymap']) ] |
|
281 | + [$owner, current($foreign['keymap'])] |
|
282 | 282 | )) |
283 | - ->map(function ($v) { |
|
283 | + ->map(function($v) { |
|
284 | 284 | $new = []; |
285 | 285 | foreach ($v as $kk => $vv) { |
286 | 286 | $new[strtoupper($kk)] = $vv; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $relname = $foreign['table']; |
296 | 296 | $cntr = 1; |
297 | 297 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
298 | - $relname = $foreign['table'] . '_' . (++ $cntr); |
|
298 | + $relname = $foreign['table'].'_'.(++$cntr); |
|
299 | 299 | } |
300 | 300 | $definition->addRelation( |
301 | 301 | new TableRelation( |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $relname = $data['table']; |
312 | 312 | $cntr = 1; |
313 | 313 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
314 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
314 | + $relname = $data['table'].'_'.(++$cntr); |
|
315 | 315 | } |
316 | 316 | $definition->addRelation( |
317 | 317 | new TableRelation( |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | LEFT JOIN all_cons_columns cc ON cc.OWNER = ac.OWNER AND cc.CONSTRAINT_NAME = ac.CONSTRAINT_NAME |
336 | 336 | WHERE ac.OWNER = ? AND ac.R_OWNER = ? AND ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ? |
337 | 337 | ORDER BY cc.POSITION", |
338 | - [ $owner, $owner, strtoupper($table), 'R' ] |
|
338 | + [$owner, $owner, strtoupper($table), 'R'] |
|
339 | 339 | )) |
340 | - ->map(function ($v) { |
|
340 | + ->map(function($v) { |
|
341 | 341 | $new = []; |
342 | 342 | foreach ($v as $kk => $vv) { |
343 | 343 | $new[strtoupper($kk)] = $vv; |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | $rcolumns = Collection::from($this |
354 | 354 | ->query( |
355 | 355 | "SELECT COLUMN_NAME FROM all_cons_columns WHERE OWNER = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION", |
356 | - [ $owner, current($data['keymap']) ] |
|
356 | + [$owner, current($data['keymap'])] |
|
357 | 357 | )) |
358 | - ->map(function ($v) { |
|
358 | + ->map(function($v) { |
|
359 | 359 | $new = []; |
360 | 360 | foreach ($v as $kk => $vv) { |
361 | 361 | $new[strtoupper($kk)] = $vv; |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $relname = $data['table']; |
371 | 371 | $cntr = 1; |
372 | 372 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
373 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
373 | + $relname = $data['table'].'_'.(++$cntr); |
|
374 | 374 | } |
375 | 375 | $definition->addRelation( |
376 | 376 | new TableRelation( |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | "SELECT TABLE_NAME FROM ALL_TABLES where OWNER = ?", |
392 | 392 | [$this->connection['name']] |
393 | 393 | )) |
394 | - ->map(function ($v) { |
|
394 | + ->map(function($v) { |
|
395 | 395 | $new = []; |
396 | 396 | foreach ($v as $kk => $vv) { |
397 | 397 | $new[strtoupper($kk)] = $vv; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | return $new; |
400 | 400 | }) |
401 | 401 | ->pluck('TABLE_NAME') |
402 | - ->map(function ($v) { |
|
402 | + ->map(function($v) { |
|
403 | 403 | return $this->table($v); |
404 | 404 | }) |
405 | 405 | ->toArray(); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | JOIN information_schema.constraint_table_usage ct ON kc.constraint_name = ct.constraint_name AND ct.table_schema = kc.table_schema |
148 | 148 | WHERE |
149 | 149 | kc.table_schema = ? AND kc.table_name IS NOT NULL AND kc.position_in_unique_constraint IS NOT NULL", |
150 | - [ $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
150 | + [$this->connection['opts']['schema'] ?? $this->connection['name']] |
|
151 | 151 | ) |
152 | 152 | )->toArray(); |
153 | 153 | foreach ($col as $row) { |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | $columns = Collection::from($this |
160 | 160 | ->query( |
161 | 161 | "SELECT * FROM information_schema.columns WHERE table_name = ? AND table_schema = ?", |
162 | - [ $table, $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
162 | + [$table, $this->connection['opts']['schema'] ?? $this->connection['name']] |
|
163 | 163 | )) |
164 | - ->mapKey(function ($v) { return $v['column_name']; }) |
|
165 | - ->map(function ($v) { |
|
164 | + ->mapKey(function($v) { return $v['column_name']; }) |
|
165 | + ->map(function($v) { |
|
166 | 166 | $v['length'] = null; |
167 | 167 | if (!isset($v['data_type'])) { |
168 | 168 | return $v; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | switch ($v['data_type']) { |
171 | 171 | case 'character': |
172 | 172 | case 'character varying': |
173 | - $v['length'] = (int)$v['character_maximum_length']; |
|
173 | + $v['length'] = (int) $v['character_maximum_length']; |
|
174 | 174 | break; |
175 | 175 | } |
176 | 176 | return $v; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ->query( |
184 | 184 | "SELECT constraint_name FROM information_schema.table_constraints |
185 | 185 | WHERE table_name = ? AND constraint_type = ? AND table_schema = ?", |
186 | - [ $table, 'PRIMARY KEY', $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
186 | + [$table, 'PRIMARY KEY', $this->connection['opts']['schema'] ?? $this->connection['name']] |
|
187 | 187 | )) |
188 | 188 | ->pluck('constraint_name') |
189 | 189 | ->value(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | ->query( |
194 | 194 | "SELECT column_name FROM information_schema.constraint_column_usage |
195 | 195 | WHERE table_name = ? AND constraint_name = ? AND table_schema = ?", |
196 | - [ $table, $pkname, $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
196 | + [$table, $pkname, $this->connection['opts']['schema'] ?? $this->connection['name']] |
|
197 | 197 | )) |
198 | 198 | ->pluck('column_name') |
199 | 199 | ->toArray(); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $usedcol = []; |
225 | 225 | if (count($columns)) { |
226 | 226 | foreach (Collection::from($relationsT[$data['table']] ?? []) |
227 | - ->filter(function ($v) use ($columns) { |
|
227 | + ->filter(function($v) use ($columns) { |
|
228 | 228 | return in_array($v['column_name'], $columns); |
229 | 229 | }) as $relation |
230 | 230 | ) { |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $relname = $foreign['table']; |
239 | 239 | $cntr = 1; |
240 | 240 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
241 | - $relname = $foreign['table'] . '_' . (++ $cntr); |
|
241 | + $relname = $foreign['table'].'_'.(++$cntr); |
|
242 | 242 | } |
243 | 243 | $definition->addRelation( |
244 | 244 | new TableRelation( |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $relname = $data['table']; |
255 | 255 | $cntr = 1; |
256 | 256 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
257 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
257 | + $relname = $data['table'].'_'.(++$cntr); |
|
258 | 258 | } |
259 | 259 | $definition->addRelation( |
260 | 260 | new TableRelation( |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $relname = $data['table']; |
279 | 279 | $cntr = 1; |
280 | 280 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
281 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
281 | + $relname = $data['table'].'_'.(++$cntr); |
|
282 | 282 | } |
283 | 283 | $definition->addRelation( |
284 | 284 | new TableRelation( |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | return Collection::from($this |
298 | 298 | ->query( |
299 | 299 | "SELECT table_name FROM information_schema.tables where table_schema = ?", |
300 | - [ $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
300 | + [$this->connection['opts']['schema'] ?? $this->connection['name']] |
|
301 | 301 | )) |
302 | 302 | ->pluck('table_name') |
303 | - ->map(function ($v) { |
|
303 | + ->map(function($v) { |
|
304 | 304 | return $this->table($v); |
305 | 305 | }) |
306 | 306 | ->toArray(); |