Browse Source

slight refactoring for #8179

tags/2.0.4
Carsten Brandt 10 years ago
parent
commit
b0be36668e
  1. 2
      framework/CHANGELOG.md
  2. 11
      framework/db/BaseActiveRecord.php

2
framework/CHANGELOG.md

@ -60,13 +60,13 @@ Yii Framework 2 Change Log
- Enh #8064: Added ability to remove containing menu tag by setting `yii\widgets\Menu::$options['tag']` to `false` (kirsenn, samdark)
- Enh #8078: 'links' and 'meta' envelope names are now configurable at `yii\rest\Serializer` (arturf)
- Enh #8171: Allow the user to enforce the fileSize to allow sending files which are not seekable. Needed when using S3 Stream Wrapper (pgaultier)
- Enh #8179: Added parameter to define whether the comparison of `yii\db\BaseActiveRecord::isAttributeChanged()` method will be made as identical (thiagotalma)
- Enh: Added `yii\helper\Console::wrapText()` method to wrap indented text by console window width and used it in `yii help` command (cebe)
- Enh: Implement batchInsert for oci (nineinchnick)
- Enh: Detecting IntegrityException for oci (nineinchnick)
- Enh: `yii\widgets\LinkPager::$firstPageLabel` and `yii\widgets\LinkPager::$lastPageLabel` now could be set to true in order to use page number as label (samdark)
- Chg #7924: Migrations in history are now ordered by time applied allowing to roll back in reverse order no matter how these were applied (samdark)
- Chg: Updated dependency to `cebe/markdown` to version `1.1.x` (cebe)
- Chg #8179: Added parameter to define whether the comparison of `yii\db\BaseActiveRecord::isAttributeChanged()` method will be made as identical (thiagotalma)
2.0.3 March 01, 2015

11
framework/db/BaseActiveRecord.php

@ -513,19 +513,20 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
/**
* Returns a value indicating whether the named attribute has been changed.
* @param string $name the name of the attribute
* @param bool $identical if the comparison is made as identical
* @param string $name the name of the attribute.
* @param bool $identical whether the comparison of new and old value is made for
* identical values using `===`, defaults to `true`. Otherwise `==` is used for comparison.
* This parameter is available since version 2.0.4.
* @return bool whether the attribute has been changed
*/
public function isAttributeChanged($name, $identical = true)
{
if (isset($this->_attributes[$name], $this->_oldAttributes[$name])) {
if ($identical) {
$changed = $this->_attributes[$name] !== $this->_oldAttributes[$name];
return $this->_attributes[$name] !== $this->_oldAttributes[$name];
} else {
$changed = $this->_attributes[$name] != $this->_oldAttributes[$name];
return $this->_attributes[$name] != $this->_oldAttributes[$name];
}
return $changed;
} else {
return isset($this->_attributes[$name]) || isset($this->_oldAttributes[$name]);
}

Loading…
Cancel
Save