Commit a97f6387 by Vladimir Zbrailov

added check column

parent 6de3e144
...@@ -284,7 +284,11 @@ class ActiveRecord extends BaseActiveRecord ...@@ -284,7 +284,11 @@ class ActiveRecord extends BaseActiveRecord
$schema = static::getTableSchema(); $schema = static::getTableSchema();
foreach ($row as $name => $value) { foreach ($row as $name => $value) {
if (isset($columns[$name])) { if (isset($columns[$name])) {
$record->setAttribute($name, $schema->getColumn($name)->typecast($value)); if ($schema->getColumn($name) !== null) {
$record->setAttribute($name, $schema->getColumn($name)->typecast($value));
} else {
$record->setAttribute($name, $value);
}
} else { } else {
$record->$name = $value; $record->$name = $value;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment