Browse Source

ActiveRecord::setOldAttribute() bugfix

tags/2.0.0-beta
Alexander Kochetov 12 years ago
parent
commit
bb2e19faa5
  1. 7
      framework/yii/db/ActiveRecord.php

7
framework/yii/db/ActiveRecord.php

@ -572,11 +572,16 @@ class ActiveRecord extends Model
* Sets the old value of the named attribute. * Sets the old value of the named attribute.
* @param string $name the attribute name * @param string $name the attribute name
* @param mixed $value the old attribute value. * @param mixed $value the old attribute value.
* @throws InvalidParamException if the named attribute does not exist.
* @see hasAttribute * @see hasAttribute
*/ */
public function setOldAttribute($name, $value) public function setOldAttribute($name, $value)
{ {
$this->_oldAttributes[$name] = $value; if (isset($this->_oldAttributes[$name]) || isset($this->getTableSchema()->columns[$name])) {
$this->_oldAttributes[$name] = $value;
} else {
throw new InvalidParamException(get_class($this) . ' has no attribute named "' . $name . '".');
}
} }
/** /**

Loading…
Cancel
Save