Hi
I’m trying to check if a model has a certain column
I tried using isset($model->column) but that doesn’t work
CActiveRecord’s __isset method returns false when the attribute has not yet been set, even though the column exists
public function __isset($name)
{
if(isset($this->_attributes[$name]))
return true;
else if(isset($this->getMetaData()->columns[$name]))
return false;
else if(isset($this->_related[$name]))
return true;
else if(isset($this->getMetaData()->relations[$name]))
return $this->getRelated($name)!==null;
else
return parent::__isset($name);
}
Is there any other way to check if a column exists?