Skip to content

Commit

Permalink
added ability to set null values in orm
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Sep 1, 2017
1 parent 689ce45 commit 3bbccd9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ public function createUpdateQuery()
$id = $this->id;
unset($this->id);
$values = "";
var_dump($this->getClassCreateVariables());
foreach ($this->getClassCreateVariables() as $key => $value) {
$values .= " `".$key."` = :".$key.",";
}
Expand All @@ -507,7 +508,12 @@ public function createUpdateQuery()
$prepared_query = $this->db_engine->prepare($sql);

foreach ($this->getClassCreateVariables() as $key => $value) {
$prepared_query->bindValue($key, $value);
if ($value == 'NULL') {
$prepared_query->bindValue($key, NULL);
} else {
$prepared_query->bindValue($key, $value);
}

}
return $prepared_query;
}
Expand Down

0 comments on commit 3bbccd9

Please sign in to comment.