@@ 169-174 (lines=6) @@ | ||
166 | { |
|
167 | $bindNameParameters = []; |
|
168 | $sqlUpdate = 'UPDATE '.$this->getTableName().' SET '; |
|
169 | foreach ($this->properties as $columnName => $columnValue) { |
|
170 | if ($columnName == 'id') { |
|
171 | continue; |
|
172 | } |
|
173 | $bindColumnName = ':'.$columnName; |
|
174 | $sqlUpdate .= "$columnName = $bindColumnName,"; |
|
175 | $bindNameParameters[$bindColumnName] = $columnValue; |
|
176 | } |
|
177 | //Remove the last comma in sql command then join it to the other query part. |
|
@@ 197-203 (lines=7) @@ | ||
194 | $columnValues = ''; |
|
195 | $bindNameParameters = []; |
|
196 | $sqlCreate = 'INSERT'.' INTO '.$this->getTableName().' ('; |
|
197 | foreach ($this->properties as $columnName => $columnValue) { |
|
198 | $bindColumnName = ':'.$columnName; |
|
199 | $columnNames .= $columnName.','; |
|
200 | $columnValues .= $bindColumnName.','; |
|
201 | $bindNameParameters[$bindColumnName] = $columnValue; |
|
202 | } |
|
203 | // Remove ending comma and whitespace. |
|
204 | $columnNames = substr($columnNames, 0, -1); |
|
205 | $columnValues = substr($columnValues, 0, -1); |
|
206 |