Browse Source

Fixes #1611: Added `BaseActiveRecord::markAttributeDirty()`

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
f77e3b4bba
  1. 1
      framework/CHANGELOG.md
  2. 11
      framework/yii/db/BaseActiveRecord.php

1
framework/CHANGELOG.md

@ -29,6 +29,7 @@ Yii Framework 2 Change Log
- Enh #1579: throw exception when the given AR relation name does not match in a case sensitive manner (qiangxue) - Enh #1579: throw exception when the given AR relation name does not match in a case sensitive manner (qiangxue)
- Enh #1581: Added `ActiveQuery::joinWith()` and `ActiveQuery::innerJoinWith()` to support joining with relations (qiangxue) - Enh #1581: Added `ActiveQuery::joinWith()` and `ActiveQuery::innerJoinWith()` to support joining with relations (qiangxue)
- Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight) - Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight)
- Enh #1611: Added `BaseActiveRecord::markAttributeDirty()` (qiangxue)
- Enh: Added `favicon.ico` and `robots.txt` to defauly application templates (samdark) - Enh: Added `favicon.ico` and `robots.txt` to defauly application templates (samdark)
- Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue) - Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue)
- Enh: Support for file aliases in console command 'message' (omnilight) - Enh: Support for file aliases in console command 'message' (omnilight)

11
framework/yii/db/BaseActiveRecord.php

@ -494,6 +494,17 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
} }
/** /**
* Marks an attribute dirty.
* This method may be called to force updating a record when calling [[update()]],
* even if there is no change being made to the record.
* @param string $name the attribute name
*/
public function markAttributeDirty($name)
{
unset($this->_oldAttributes[$name]);
}
/**
* Returns a value indicating whether the named attribute has been changed. * Returns a value indicating whether the named attribute has been changed.
* @param string $name the name of the attribute * @param string $name the name of the attribute
* @return boolean whether the attribute has been changed * @return boolean whether the attribute has been changed

Loading…
Cancel
Save