@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | public function update() |
153 | 153 | { |
154 | 154 | $bindNameParameters = []; |
155 | - $sqlUpdate = 'UPDATE '.$this->getTableName().' SET '; |
|
155 | + $sqlUpdate = 'UPDATE ' . $this->getTableName() . ' SET '; |
|
156 | 156 | foreach ($this->properties as $columnName => $columnValue) { |
157 | 157 | if ($columnName == 'id') { |
158 | 158 | continue; |
159 | 159 | } |
160 | - $bindColumnName = ':'.$columnName; |
|
160 | + $bindColumnName = ':' . $columnName; |
|
161 | 161 | $sqlUpdate .= "$columnName = $bindColumnName,"; |
162 | 162 | $bindNameParameters[$bindColumnName] = $columnValue; |
163 | 163 | } |
164 | 164 | //Remove the last comma in sql command then join it to the other query part. |
165 | - $sqlUpdate = substr($sqlUpdate, 0, -1).' WHERE id = :id'; |
|
165 | + $sqlUpdate = substr($sqlUpdate, 0, -1) . ' WHERE id = :id'; |
|
166 | 166 | $sqlStatement = $this->databaseConnection->prepare($sqlUpdate); |
167 | 167 | $bindNameParameters[':id'] = $this->properties['id']; |
168 | 168 | $sqlStatement->execute($bindNameParameters); |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | $columnNames = ''; |
181 | 181 | $columnValues = ''; |
182 | 182 | $bindNameParameters = []; |
183 | - $sqlCreate = 'INSERT'.' INTO '.$this->getTableName().' ('; |
|
183 | + $sqlCreate = 'INSERT' . ' INTO ' . $this->getTableName() . ' ('; |
|
184 | 184 | foreach ($this->properties as $columnName => $columnValue) { |
185 | - $bindColumnName = ':'.$columnName; |
|
186 | - $columnNames .= $columnName.','; |
|
187 | - $columnValues .= $bindColumnName.','; |
|
185 | + $bindColumnName = ':' . $columnName; |
|
186 | + $columnNames .= $columnName . ','; |
|
187 | + $columnValues .= $bindColumnName . ','; |
|
188 | 188 | $bindNameParameters[$bindColumnName] = $columnValue; |
189 | 189 | } |
190 | 190 | // Remove ending comma and whitespace. |
191 | 191 | $columnNames = substr($columnNames, 0, -1); |
192 | 192 | $columnValues = substr($columnValues, 0, -1); |
193 | 193 | |
194 | - $sqlCreate .= $columnNames.') VALUES ('.$columnValues.')'; |
|
194 | + $sqlCreate .= $columnNames . ') VALUES (' . $columnValues . ')'; |
|
195 | 195 | $sqlStatement = $this->databaseConnection->prepare($sqlCreate); |
196 | 196 | $sqlStatement->execute($bindNameParameters); |
197 | 197 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function delete($id) |
233 | 233 | { |
234 | - $sql = 'DELETE'.' FROM '.self::getTableName().' WHERE id = '.$id; |
|
234 | + $sql = 'DELETE' . ' FROM ' . self::getTableName() . ' WHERE id = ' . $id; |
|
235 | 235 | $sqlStatment = $this->databaseConnection->prepare($sql); |
236 | 236 | $sqlStatment->execute(); |
237 | 237 |