当我尝试执行管理操作以列出特定类的所有实例化实体时出现此错误:
包括(authenticate.php):无法打开流:没有这样的文件或目录/home/user/NetBeansProjects/yii/framework/YiiBase.php(423)
{
412 include($classFile);
413 if(YII_DEBUG && basename(realpath($classFile))!==$className.'.php')
414 throw new CException(Yii::t('yii','Class name "{class}" does not match class file "{file}".', array(
415 '{class}'=>$className,
416 '{file}'=>$classFile,
417 )));
418 break;
419 }
420 }
421 }
422 else
423 include($className.'.php');
424 }
425 else // class name with namespace in PHP 5.3
426 {
427 $namespace=str_replace('\\','.',ltrim($className,'\\'));
428 if(($path=self::getPathOfAlias($namespace))!==false)
429 include($path.'.php');
430 else
431 return false;
432 }
433 return class_exists($className,false) || interface_exists($className,false);
434 }
435 return true;
视图文件夹管理文件中的 CGridView
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'utente-crea-evento-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'status',
'username',
'password', other properties
管理员操作
public function actionAdmin()
{
$model=new UtenteCreaEvento('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['UtenteCreaEvento']))
$model->attributes=$_GET['UtenteCreaEvento'];
$this->render('admin',array(
'model'=>$model,
));
}
更多堆栈跟踪信息
#0
+ /home/sigturk/NetBeansProjects/yii/framework/YiiBase.php(423): YiiBase::autoload()
#1
+ /home/sigturk/NetBeansProjects/yii/framework/YiiBase.php(298): YiiBase::autoload("authenticate")
#2
+ /home/sigturk/NetBeansProjects/yii/framework/validators/CValidator.php(187): YiiBase::import("authenticate", true)
#3
+ /home/sigturk/NetBeansProjects/yii/framework/base/CModel.php(285): CValidator::createValidator("authenticate", UtenteCreaEvento, "password", array())
#4
+ /home/sigturk/NetBeansProjects/yii/framework/base/CModel.php(259): CModel->createValidators()
#5
+ /home/sigturk/NetBeansProjects/yii/framework/web/helpers/CHtml.php(1871): CModel->getValidators("numTel")
#6
+ /home/sigturk/NetBeansProjects/yii/framework/web/helpers/CHtml.php(1217): CHtml::activeInputField("text", UtenteCreaEvento, "numTel", array("name" => "UtenteCreaEvento[numTel]", "id" => "UtenteCreaEvento_numTel"))
#7
+ /home/sigturk/NetBeansProjects/yii/framework/web/widgets/CActiveForm.php(658): CHtml::activeTextField(UtenteCreaEvento, "numTel", array())
#8
– /home/sigturk/NetBeansProjects/sitoEventi/protected/views/utenteCreaEvento/_search.php(42): CActiveForm->textField(UtenteCreaEvento, "numTel")
37 <?php echo $form->textField($model,'cognome',array('size'=>60,'maxlength'=>128)); ?>
38 </div>
39
40 <div class="row">
41 <?php echo $form->label($model,'numTel'); ?>
42 <?php echo $form->textField($model,'numTel'); ?>
43 </div>
44
45 <div class="row">
46 <?php echo $form->label($model,'numEventiCreati'); ?>
47 <?php echo $form->textField($model,'numEventiCreati'); ?>
#9
+ /home/sigturk/NetBeansProjects/yii/framework/web/CBaseController.php(127): require("/home/sigturk/NetBeansProjects/sitoEventi/protected/views/utente...")
#10
+ /home/sigturk/NetBeansProjects/yii/framework/web/CBaseController.php(96): CBaseController->renderInternal("/home/sigturk/NetBeansProjects/sitoEventi/protected/views/utente...", array("model" => UtenteCreaEvento), true)
#11
+ /home/sigturk/NetBeansProjects/yii/framework/web/CController.php(870): CBaseController->renderFile("/home/sigturk/NetBeansProjects/sitoEventi/protected/views/utente...", array("model" => UtenteCreaEvento), true)
#12
– /home/sigturk/NetBeansProjects/sitoEventi/protected/views/utenteCreaEvento/admin.php(40): CController->renderPartial("_search", array("model" => UtenteCreaEvento))
35
36 <?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
37 <div class="search-form" style="display:none">
38 <?php $this->renderPartial('_search',array(
39 'model'=>$model,
40 )); ?>
41 </div><!-- search-form -->
42
43 <?php $this->widget('zii.widgets.grid.CGridView', array(
44 'id'=>'utente-crea-evento-grid',
45 'dataProvider'=>$model->search(),
#13
+ /home/sigturk/NetBeansProjects/yii/framework/web/CBaseController.php(127): require("/home/sigturk/NetBeansProjects/sitoEventi/protected/views/utente...")
#14
+ /home/sigturk/NetBeansProjects/yii/framework/web/CBaseController.php(96): CBaseController->renderInternal("/home/sigturk/NetBeansProjects/sitoEventi/protected/views/utente...", array("model" => UtenteCreaEvento), true)
#15
+ /home/sigturk/NetBeansProjects/yii/framework/web/CController.php(870): CBaseController->renderFile("/home/sigturk/NetBeansProjects/sitoEventi/protected/views/utente...", array("model" => UtenteCreaEvento), true)
#16
+ /home/sigturk/NetBeansProjects/yii/framework/web/CController.php(783): CController->renderPartial("admin", array("model" => UtenteCreaEvento), true)
#17
– /home/sigturk/NetBeansProjects/sitoEventi/protected/controllers/UtenteCreaEventoController.php(146): CController->render("admin", array("model" => UtenteCreaEvento))
141 if(isset($_GET['UtenteCreaEvento']))
142 $model->attributes=$_GET['UtenteCreaEvento'];
143
144 $this->render('admin',array(
145 'model'=>$model,
146 ));
147 }
148
149 /**
150 * Returns the data model based on the primary key given in the GET variable.
151 * If the data model is not found, an HTTP exception will be raised.
#18 */
+ /home/sigturk/NetBeansProjects/yii/framework/web/actions/CInlineAction.php(50): UtenteCreaEventoController->actionAdmin()
#19
+ /home/sigturk/NetBeansProjects/yii/framework/web/CController.php(309): CInlineAction->runWithParams(array())
#20
+ /home/sigturk/NetBeansProjects/yii/framework/web/filters/CFilterChain.php(134): CController->runAction(CInlineAction)
#21
+ /home/sigturk/NetBeansProjects/yii/framework/web/filters/CFilter.php(41): CFilterChain->run()
#22
+ /home/sigturk/NetBeansProjects/yii/framework/web/CController.php(1146): CFilter->filter(CFilterChain)
#23
+ /home/sigturk/NetBeansProjects/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(CFilterChain)
#24
+ /home/sigturk/NetBeansProjects/yii/framework/web/filters/CFilterChain.php(131): CInlineFilter->filter(CFilterChain)
#25
+ /home/sigturk/NetBeansProjects/yii/framework/web/CController.php(292): CFilterChain->run()
#26
+ /home/sigturk/NetBeansProjects/yii/framework/web/CController.php(266): CController->runActionWithFilters(CInlineAction, array("accessControl", "postOnly + delete"))
#27
+ /home/sigturk/NetBeansProjects/yii/framework/web/CWebApplication.php(283): CController->run("admin")
#28
+ /home/sigturk/NetBeansProjects/yii/framework/web/CWebApplication.php(142): CWebApplication->runController("utenteCreaEvento/admin")
#29
+ /home/sigturk/NetBeansProjects/yii/framework/base/CApplication.php(162): CWebApplication->processRequest()
#30
+ /home/sigturk/NetBeansProjects/sitoEventi/index.php(13): CApplication->run()
模型
class UtenteCreaEvento extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return UtenteCreaEvento 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 'tbl_utenteCreaEvento';
}
/**
* @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('username, password, nome, cognome, email', 'required'),
array('status, numTel, numEventiCreati, numFeedPositivi, statoCanone', 'numerical', 'integerOnly'=>true),
array('username, password, nome, cognome', 'length', 'max'=>128),
array('password','length','min'=>6),
array('password','authenticate'),
array('email', 'length', 'max'=>256),
array('email', 'email'),
array('numTel, numEventiCreati, numFeedPositivi, statoCanone','safe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, status, username, nome, cognome, numTel, numEventiCreati, numFeedPositivi, email, statoCanone, dataCreazioneProfilo', '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(
'eventiCreati' => array(self::HAS_MANY, 'Evento', 'creatoDa'),
'fotoCaricate' => array(self::HAS_MANY, 'Foto', 'caricataDaUtenteEventi'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'id' => 'ID',
'status' => 'Status',
'username' => 'Username',
'password' => 'Password',
'nome' => 'Nome',
'cognome' => 'Cognome',
'numTel' => 'Num Tel',
'numEventiCreati' => 'Num Eventi Creati',
'numFeedPositivi' => 'Num Feed Positivi',
'email' => 'Email',
'statoCanone' => 'Stato Canone',
'dataCreazioneProfilo' => 'Data Creazione Profilo',
);
}
/**
* 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('id',$this->id,true);
$criteria->compare('status',$this->status);
$criteria->compare('username',$this->username,true);
$criteria->compare('password',$this->password,true);
$criteria->compare('nome',$this->nome,true);
$criteria->compare('cognome',$this->cognome,true);
$criteria->compare('numTel',$this->numTel);
$criteria->compare('numEventiCreati',$this->numEventiCreati);
$criteria->compare('numFeedPositivi',$this->numFeedPositivi);
$criteria->compare('email',$this->email,true);
$criteria->compare('statoCanone',$this->statoCanone);
$criteria->compare('dataCreazioneProfilo',$this->dataCreazioneProfilo,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
/**
* This is invoked before the record is saved.
* @return boolean whether the record should be saved.
*/
protected function beforeSave()
{
if ($this->isNewRecord)
$this->dataCreazioneProfilo = new CDbExpression('NOW()');
$this->status = 0;
$this->statoCanone = 0;
return parent::beforeSave();
}
控制器
public function actionView($id)
{
$this->render('view',array(
'model'=>$this->loadModel($id),
));
}
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model=new UtenteCreaEvento;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['UtenteCreaEvento']))
{
$model->attributes=$_POST['UtenteCreaEvento'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
));
}
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model=$this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['UtenteCreaEvento']))
{
$model->attributes=$_POST['UtenteCreaEvento'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('update',array(
'model'=>$model,
));
}
/**
* Deletes a particular model.
* If deletion is successful, the browser will be redirected to the 'admin' page.
* @param integer $id the ID of the model to be deleted
*/
public function actionDelete($id)
{
// $this->loadModel($id)->delete();
$utentecreaEvento = new UtenteCreaEvento();
$utentecreaEvento = UtenteCreaEvento::model()->find('id',$id);
$utentecreaEvento->status = 0;
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if(!isset($_GET['ajax']))
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
}
/**
* Lists all models.
*/
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('UtenteCreaEvento');
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
/**
* Manages all models.
*/
public function actionAdmin()
{
$model=new UtenteCreaEvento('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['UtenteCreaEvento']))
$model->attributes=$_GET['UtenteCreaEvento'];
$this->render('admin',array(
'model'=>$model,
));
}
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer the ID of the model to be loaded
*/
public function loadModel($id)
{
$model=UtenteCreaEvento::model()->findByPk($id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}
/**
* Performs the AJAX validation.
* @param CModel the model to be validated
*/
protected function performAjaxValidation($model)
{
if(isset($_POST['ajax']) && $_POST['ajax']==='utente-crea-evento-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
仅当我尝试管理此类的实体时才会出现这种错误,但所有其他类型的操作都不会产生任何问题。提前致谢