fix(model): Remove the NULL check in the attribute loop

This commit is contained in:
kj
2026-06-19 15:27:18 -03:00
parent b95747bfe0
commit b13c07d3c4

View File

@@ -480,12 +480,8 @@ class Model
$set = [];
foreach ($atts as $key => $value) {
if ($value !== null) {
$set[] = "$key=:$key";
static::$dbQueryVariables[':' . $key] = $value;
} else {
$set[] = "$key=NULL";
}
}
$table = static::table();
@@ -511,12 +507,10 @@ class Model
static::$dbQueryVariables = [];
foreach ($atts as $key => $value) {
if (isset($value)) {
$into[] = "$key";
$values[] = ":$key";
static::$dbQueryVariables[":$key"] = $value;
}
}
$table = static::table();
$sql = "INSERT INTO $table (" . join(', ', $into) . ") VALUES (" . join(', ', $values) . ")";