Fixed yii\db\ActiveRecord does not updates attribute specified at optimisticLock() after save

This commit is contained in:
Klimov Paul
2015-05-26 11:53:34 +03:00
parent 2434511c6e
commit 51a442d6c8
10 changed files with 107 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ Yii Framework 2 Change Log
- Bug #8451: `yii\i18n\Formatter` did not allow negative unix timestamps as input for date formatting (cebe)
- Bug #8483: sequence name in `Schema::getLastInsertId()` was not properly quoted (nineinchnick)
- Bug #8506: Cleaning of output buffer in `Widget::run()` conflicts with `Pjax` widget which did the cleanup itself (cebe, joester89)
- Bug #8544: Fixed `yii\db\ActiveRecord` does not updates attribute specified at `optimisticLock()` after save (klimov-paul)
- Bug: Fixed string comparison in `BaseActiveRecord::unlink()` which may result in wrong comparison result for hash valued primary keys starting with `0e` (cebe)
- Enh #7169: `yii\widgets\ActiveField` now uses corresponding methods for default parts rendering (klimov-paul)
- Enh #8070: `yii\console\controllers\MessageController` now sorts created messages, even if there is no new one, while saving to PHP file (klimov-paul)

View File

@@ -725,6 +725,9 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
foreach ($values as $name => $value) {
$changedAttributes[$name] = isset($this->_oldAttributes[$name]) ? $this->_oldAttributes[$name] : null;
$this->_oldAttributes[$name] = $value;
if ($name === $lock) {
$this->$lock = $value;
}
}
$this->afterSave(false, $changedAttributes);