@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return; |
| 97 | 97 | |
| 98 | 98 | $runAgain = false; |
| 99 | - $columns = $this->pdo->query('SELECT * FROM '. $this->quote($table) . ' PROCEDURE ANALYSE(1,1)')->fetchAll(\PDO::FETCH_OBJ); |
|
| 99 | + $columns = $this->pdo->query('SELECT * FROM ' . $this->quote($table) . ' PROCEDURE ANALYSE(1,1)')->fetchAll(\PDO::FETCH_OBJ); |
|
| 100 | 100 | foreach ($columns as $column) { |
| 101 | 101 | $parts = explode('.', $column->Field_name); |
| 102 | 102 | $name = $this->quote(end($parts)); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $this->pdo->query('ALTER TABLE ' . $this->quote($table) . ' MODIFY '. $name . ' ' . $type); |
|
| 133 | + $this->pdo->query('ALTER TABLE ' . $this->quote($table) . ' MODIFY ' . $name . ' ' . $type); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | //Sometimes a second pass is needed, if a column has gone from varchar -> int(11) a better int type may be needed |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | //bit hacky, breaking encapsulation, but simplest way to work out the info for the other side of the many:many relationship. |
| 38 | 38 | private function getOtherFieldNameInfo() { |
| 39 | 39 | if ($this->otherInfo == null) { |
| 40 | - $propertyReader = function($name) {return $this->$name; }; |
|
| 40 | + $propertyReader = function($name) {return $this->$name; }; |
|
| 41 | 41 | |
| 42 | 42 | $reader = $propertyReader->bindTo($this->intermediateMapper, $this->intermediateMapper); |
| 43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $propertyReader = $propertyReader->bindTo($relation, $relation); |
| 46 | 46 | if ($propertyReader('parentField') != $this->parentField) { |
| 47 | 47 | $relation = $relation->getData($this->object); |
| 48 | - $this->otherInfo = [$propertyReader('localField'), $propertyReader('parentField'), $propertyReader('mapper')]; |
|
| 48 | + $this->otherInfo = [$propertyReader('localField'), $propertyReader('parentField'), $propertyReader('mapper')]; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | private function offsetSetAutotraverse($value, $relatedField, $valueField) { |
| 105 | 105 | $record = new \stdClass; |
| 106 | - $record->{$this->parentField} = $value->{$this->localField}; |
|
| 106 | + $record->{$this->parentField} = $value->{$this->localField}; |
|
| 107 | 107 | $record->$valueField = $this->object->{$relatedField}; |
| 108 | 108 | $this->intermediateMapper[] = $record; |
| 109 | 109 | } |
@@ -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 | } |