I am getting a warning that argument is missing when try to create a project from gii.
The project is created. I can see this checking http://localhost/demoproject/index.php?r=project
But i am not redirected to page where Operations are listed, like Create, Update, Delete.
I mean url http://localhost/demoproject/index.php?r=project/view&id=4 shows warning instead of created project.
PHP warning
Missing argument 1 for ProjectController::loadModel(), called in C:\xampp\htdocs\demoproject\protected\controllers\ProjectController.php on line 57 and defined
C:\xampp\htdocs\demoproject\protected\controllers\ProjectController.php(166)
154 $this->render('admin',array(
155 'model'=>$model,
156 ));
157 }
158
159 /**
160 * Returns the data model based on the primary key given in the GET variable.
161 * If the data model is not found, an HTTP exception will be raised.
162 * @param integer $id the ID of the model to be loaded
163 * @return Project the loaded model
164 * @throws CHttpException
165 */
166 public function loadModel($id)
167 {
168 $model=Project::model()->findByPk($id);
169 if($model===null)
170 throw new CHttpException(404,'The requested page does not exist.');
171 return $model;
172 }
173
174 /**
175 * Performs the AJAX validation.
176 * @param Project $model the model to be validated
177 */
178 protected function performAjaxValidation($model)
Stack Trace
#0
–
C:\xampp\htdocs\demoproject\protected\controllers\ProjectController.php(57): ProjectController->loadModel()
52 public function actionView($id)
53 {
54 $issueDataProvider=new CActiveDataProvider('Issue', array(
55 'criteria'=>array(
56 'condition'=>'project_id=:projectId',
57 'params'=>array(':projectId'=>$this->loadModel()->id),
58 ),
59 'pagination'=>array(
60 'pageSize'=>1,
61 ),
62 ));
#1
unknown(0): ProjectController->actionView("4")
#2
+
C:\xampp\htdocs\yii\framework\web\actions\CAction.php(108): ReflectionMethod->invokeArgs(ProjectController, array("4"))
#3
+
C:\xampp\htdocs\yii\framework\web\actions\CInlineAction.php(47): CAction->runWithParamsInternal(ProjectController, ReflectionMethod, array("r" => "project/view", "id" => "4"))
#4
+
C:\xampp\htdocs\yii\framework\web\CController.php(308): CInlineAction->runWithParams(array("r" => "project/view", "id" => "4"))
#5
+
C:\xampp\htdocs\yii\framework\web\filters\CFilterChain.php(133): CController->runAction(CInlineAction)
#6
+
C:\xampp\htdocs\yii\framework\web\filters\CFilter.php(40): CFilterChain->run()
#7
+
C:\xampp\htdocs\yii\framework\web\CController.php(1145): CFilter->filter(CFilterChain)
#8
+
C:\xampp\htdocs\yii\framework\web\filters\CInlineFilter.php(58): CController->filterAccessControl(CFilterChain)
#9
+
C:\xampp\htdocs\yii\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter(CFilterChain)
#10
+
C:\xampp\htdocs\yii\framework\web\CController.php(291): CFilterChain->run()
#11
+
C:\xampp\htdocs\yii\framework\web\CController.php(265): CController->runActionWithFilters(CInlineAction, array("accessControl", "postOnly + delete"))
#12
+
C:\xampp\htdocs\yii\framework\web\CWebApplication.php(282): CController->run("view")
#13
+
C:\xampp\htdocs\yii\framework\web\CWebApplication.php(141): CWebApplication->runController("project/view")
#14
+
C:\xampp\htdocs\yii\framework\base\CApplication.php(180): CWebApplication->processRequest()
#15
–
C:\xampp\htdocs\demoproject\index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11
12 require_once($yii);
13 Yii::createWebApplication($config)->run();