I have an error but i can’t solve it.
Error: Property "CDbCriteria.idCT" is not defined.
this is my controller:
public function actionDetail()
{
if(isset($_GET['maGD']))
{
$model=new CtHd();
$model->unsetAttributes();
$dataProvider=new CActiveDataProvider('CtHd', array(
'criteria'=>$model,
'condition' =>"maGD=:maGD",
'params'=>array(
':maGD' =>$_GET['maGD'],
),
//'pagination'=>array('pageSize'=>10),
));
$this->render('detail',array(
//'dataProvider'=>$dataProvider,
'model'=>$model,
));
}
}
this is my view:
<div class="span-19">
<?php
if(isset($_GET['maGD']))
{
$this->renderPartial('detail',array(
//'dataProvider'=>$dataProvider,
'model'=>$model,
));
}
?>
</div>
this is my model:
<?php
/**
* This is the model class for table "ct_hd".
*
* The followings are the available columns in table 'ct_hd':
* @property integer $idCT
* @property integer $maSP
* @property integer $maGD
* @property integer $soSP
* @property string $donGia
*/
class CtHd extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @return CtHd the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'ct_hd';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('maSP, maGD, soSP', 'numerical', 'integerOnly'=>true),
array('donGia', 'length', 'max'=>10),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('idCT, maSP, maGD, soSP, donGia', 'safe', 'on'=>'search'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'idCT' => 'Id Ct',
'maSP' => 'Ma Sp',
'maGD' => 'Ma Gd',
'soSP' => 'So Sp',
'donGia' => 'Don Gia',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('idCT',$this->idCT);
$criteria->compare('maSP',$this->maSP);
$criteria->compare('maGD',$this->maGD);
$criteria->compare('soSP',$this->soSP);
$criteria->compare('donGia',$this->donGia);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
}
and i can't debug yii in netbeans use xdebug:
this is my config in php.ini:
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000