Skip to content

Commit

Permalink
Chg: cast "value" correctly to string/int/float of the "default" rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Petrov committed Sep 28, 2023
1 parent f1a519b commit dd999c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/generators/model/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,8 @@ public function generateRules($table)
}
if (!empty($defaultValues)) {
foreach ($defaultValues as $defaultValue => $defaultValueColumns) {
$rules[] = "[['" . implode("', '", $defaultValueColumns) . "'], 'default', 'value' => '$defaultValue']";
$defaultValue = is_numeric($defaultValue) ? $defaultValue : "'$defaultValue'";
$rules[] = "[['" . implode("', '", $defaultValueColumns) . "'], 'default', 'value' => $defaultValue]";
}
}
$driverName = $this->getDbDriverName();
Expand Down

0 comments on commit dd999c0

Please sign in to comment.