diff --git a/framework/yii/db/ActiveRecord.php b/framework/yii/db/ActiveRecord.php index 5265a81..6e42106 100644 --- a/framework/yii/db/ActiveRecord.php +++ b/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) */