Browse Source

Fixes #717: Added ActiveRecord::hasAttribute()

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
6823fdedaf
  1. 10
      framework/yii/db/ActiveRecord.php

10
framework/yii/db/ActiveRecord.php

@ -536,6 +536,16 @@ class ActiveRecord extends Model
}
/**
* Returns a value indicating whether the model has an attribute with the specified name.
* @param string $name the name of the attribute
* @return boolean whether the model has an attribute with the specified name.
*/
public function hasAttribute($name)
{
return isset($this->_attributes[$name]) || isset($this->getTableSchema()->columns[$name]);
}
/**
* Returns the old attribute values.
* @return array the old attribute values (name-value pairs)
*/

Loading…
Cancel
Save