Browse Source

ActiveRecord::setAttribute() bugfix

tags/2.0.0-beta
Alexander Kochetov 12 years ago
parent
commit
8de3ffabfe
  1. 5
      framework/yii/db/ActiveRecord.php

5
framework/yii/db/ActiveRecord.php

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

Loading…
Cancel
Save