Commit a97f6387 by Vladimir Zbrailov

added check column

parent 6de3e144
...@@ -284,8 +284,12 @@ class ActiveRecord extends BaseActiveRecord ...@@ -284,8 +284,12 @@ 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])) {
if ($schema->getColumn($name) !== null) {
$record->setAttribute($name, $schema->getColumn($name)->typecast($value)); $record->setAttribute($name, $schema->getColumn($name)->typecast($value));
} else { } else {
$record->setAttribute($name, $value);
}
} 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