@@ -26,7 +26,7 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | private function addRelationData($object, $name, $relation, $siblings) { |
29 | - if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation) ) { |
|
29 | + if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation)) { |
|
30 | 30 | //After overwriting the relation, does the parent object ($object) need overwriting as well? |
31 | 31 | if ($relation->overwrite($object, $object->$name)) $this->parent[] = $object; |
32 | 32 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | private function tableExists($name) { |
43 | - $result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="'. $name.'"'); |
|
43 | + $result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="' . $name . '"'); |
|
44 | 44 | return count($result->fetchAll()) == 1; |
45 | 45 | } |
46 | 46 | |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | $this->stmtCache->clearCache(); |
61 | 61 | |
62 | 62 | // Create temp table to create a new structure |
63 | - $affix = '_'.substr(md5($table), 0, 6); |
|
63 | + $affix = '_' . substr(md5($table), 0, 6); |
|
64 | 64 | $tempTable = $table . $affix; |
65 | 65 | $this->generalEditor->createTable($tempTable, $primaryKey, $data); |
66 | 66 | $this->alterColumns($tempTable, $primaryKey, $data); |
67 | 67 | $this->copyTableData($table, $tempTable); |
68 | 68 | |
69 | - $this->pdo->query('DROP TABLE IF EXISTS ' . $table ); |
|
70 | - $this->pdo->query('ALTER TABLE ' . $tempTable . ' RENAME TO '. $table ); |
|
69 | + $this->pdo->query('DROP TABLE IF EXISTS ' . $table); |
|
70 | + $this->pdo->query('ALTER TABLE ' . $tempTable . ' RENAME TO ' . $table); |
|
71 | 71 | |
72 | 72 | } |
73 | 73 |
@@ -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 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | |
81 | 81 | private function convertDates($value) { |
82 | 82 | if ($value instanceof \DateTimeInterface) { |
83 | - if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d'); |
|
83 | + if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d'); |
|
84 | 84 | else $value = $value->format('Y-m-d H:i:s'); |
85 | 85 | } |
86 | 86 | return $value; |