@@ -22,7 +22,7 @@ |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if (count($inSql) == 0) return ['args' => [], 'sql' => '']; |
| 25 | - else $sql = [$key . $notText . ' IN ( ' . implode(', ', $inSql) . ')']; |
|
| 25 | + else $sql = [$key . $notText . ' IN ( ' . implode(', ', $inSql) . ')']; |
|
| 26 | 26 | |
| 27 | 27 | return ['args' => $args, 'sql' => $sql]; |
| 28 | 28 | } |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | //For dates with times set, search on time, if the time is not set, search on date only. |
| 21 | 21 | //E.g. searching for all records posted on '2015-11-14' should return all records that day, not just the ones posted at 00:00:00 on that day |
| 22 | 22 | if ($value instanceof \DateTimeInterface) { |
| 23 | - if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d'); |
|
| 23 | + if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d'); |
|
| 24 | 24 | else $value = $value->format('Y-m-d H:i:s'); |
| 25 | 25 | } |
| 26 | 26 | if (is_object($value)) continue; |
| 27 | - if ($prependField){ |
|
| 27 | + if ($prependField) { |
|
| 28 | 28 | $sql[] = $this->quote($field) . ' = :' . $field; |
| 29 | 29 | } else { |
| 30 | 30 | $sql[] = ':' . $field; |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function insert($table, $data) { |
| 38 | 38 | $query = $this->buildSaveQuery($data); |
| 39 | - return new Query('INSERT INTO ' . $this->quote($table) . ' (' .implode(', ', array_keys($query['args'])).') VALUES ( ' . implode(', ', $query['sql']). ' )', $query['args']); |
|
| 39 | + return new Query('INSERT INTO ' . $this->quote($table) . ' (' . implode(', ', array_keys($query['args'])) . ') VALUES ( ' . implode(', ', $query['sql']) . ' )', $query['args']); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function update($table, array $primaryKey, $data) { |
| 43 | 43 | $query = $this->buildSaveQuery($data, true); |
| 44 | 44 | $where = []; |
| 45 | - foreach($primaryKey as $field) $where[] = $this->quote($field) . ' = :' . $field; |
|
| 46 | - return new Query('UPDATE ' . $this->quote($table) . ' SET ' . implode(', ', $query['sql']). ' WHERE '. implode(' AND ', $where), $query['args']); |
|
| 45 | + foreach ($primaryKey as $field) $where[] = $this->quote($field) . ' = :' . $field; |
|
| 46 | + return new Query('UPDATE ' . $this->quote($table) . ' SET ' . implode(', ', $query['sql']) . ' WHERE ' . implode(' AND ', $where), $query['args']); |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function getCacheMode() { |
| 27 | - return (int) ($this->options['cachemode'] ?? 0); |
|
| 27 | + return (int)($this->options['cachemode'] ?? 0); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function read($option) { |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | |
| 128 | 128 | public function updateCache($data, $pkValue) { |
| 129 | 129 | if ($this->cacheMode >= 0) { |
| 130 | - if (isset($this->cache[$pkValue])) $this->cache[$pkValue] = (object) array_merge((array)$this->cache[$pkValue], (array)$data); |
|
| 130 | + if (isset($this->cache[$pkValue])) $this->cache[$pkValue] = (object)array_merge((array)$this->cache[$pkValue], (array)$data); |
|
| 131 | 131 | else $this->cache[$pkValue] = $data; |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -19,9 +19,9 @@ |
||
| 19 | 19 | $this->primaryKey = is_array($primaryKey) ? $primaryKey : [$primaryKey]; |
| 20 | 20 | $this->table = $table; |
| 21 | 21 | |
| 22 | - $this->fields = implode(',', array_map([$adapter, 'quote'], (array) $options->read('fields'))); |
|
| 22 | + $this->fields = implode(',', array_map([$adapter, 'quote'], (array)$options->read('fields'))); |
|
| 23 | 23 | |
| 24 | - $defaultSort = $options->read('defaultSort') !== false ? $options->read('defaultSort') : implode(', ', $this->primaryKey); |
|
| 24 | + $defaultSort = $options->read('defaultSort') !== false ? $options->read('defaultSort') : implode(', ', $this->primaryKey); |
|
| 25 | 25 | |
| 26 | 26 | $databaseModify = new DatabaseModify($adapter, $options->getEditMode(), $table); |
| 27 | 27 | |