我正在使用Yii 1.1。我在名为MyCommentsTbEditableSaver的小部件文件夹中有一个类文件。 当我尝试用那个php文件回显数据时。它不会返回任何东西。 这背后的原因是什么? 我的代码:`
public function insertRps()
{
//get params from request
$this->primaryKey = yii::app()->request->getParam('pk');
$this->attribute = yii::app()->request->getParam('name');
//$this->attribute = yii::app()->request->getParam('comments');
$this->value = yii::app()->request->getParam('value');
//checking params
if (empty($this->attribute)) {
throw new CException(Yii::t('MyCommentsTbEditableSaver.editable', 'Property "attribute" should be defined.'));
}
if (empty($this->primaryKey)) {
throw new CException(Yii::t('MyCommentsTbEditableSaver.editable', 'Property "primaryKey" should be defined.'));
}
$model=new ProjectComments();
$comments=Yii::app()->db->createCommand()
->select('count(project_id) as countProject')
->from('pm_project_comments')
->where("project_id = $this->primaryKey ")
->queryRow();
if($comments['countProject']==0)
{
$model->isNewRecord=TRUE;
$model->comments_rps=$this->value;
$model->project_id=$this->primaryKey;
//also set update details,added by bishal
$model->crtd_by=Yii::app()->user->id;
$model->crtd_dt = date('Y-m-d');
print_r($model);die;
$model->save();
}
}`