i had one table previously i.e. yii_tbl_item with columns id,name description but afterwards i added one more column as categoryid
but now i am getting below error
YiiBase::include(CategoryID.php) [<a href=‘function.YiiBase-include’>function.YiiBase-include</a>]: failed to open stream: No such file or directory
I also made changes in model file for rules(),attributeLabels(),search() methods.
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('CategoryID', 'numerical', 'integerOnly'=>true),
array('Price', 'numerical'),
array('Name', 'length', 'max'=>255),
array('Description', 'safe'),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('id, Name, Description, Price','CategoryID', 'safe', 'on'=>'search'),
);
}
public function attributeLabels()
{
return array(
'id' => 'ID',
'Name' => 'Name',
'Description' => 'Description',
'Price' => 'Price',
'CategoryID' => 'CategoryID',
);
}
public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id);
$criteria->compare('Name',$this->Name,true);
$criteria->compare('Description',$this->Description,true);
$criteria->compare('Price',$this->Price);
$criteria->compare('CategoryID',$this->CategoryID);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}