mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-20 08:27:21 +08:00
PK typecast at yii\db\ActiveRecord restored
This commit is contained in:
@@ -457,8 +457,14 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
if (($primaryKeys = static::getDb()->schema->insert($this->tableName(), $values)) === false) {
|
if (($primaryKeys = static::getDb()->schema->insert($this->tableName(), $values)) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->setAttributes($primaryKeys, false);
|
foreach ($primaryKeys as $name => $value) {
|
||||||
$values = array_merge($values, $primaryKeys);
|
if ($this->getAttribute($name) === null) {
|
||||||
|
$id = $this->getTableSchema()->columns[$name]->phpTypecast($value);
|
||||||
|
$this->setAttribute($name, $id);
|
||||||
|
$values[$name] = $id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$changedAttributes = array_fill_keys(array_keys($values), null);
|
$changedAttributes = array_fill_keys(array_keys($values), null);
|
||||||
$this->setOldAttributes($values);
|
$this->setOldAttributes($values);
|
||||||
|
|||||||
Reference in New Issue
Block a user