I've been following the demo in the PDF version and have hit a snag on page 131.
after making all the changes and attempting to display Project Issues ( http://localhost/tra...oject/view&id=1) I am greeted with the following PHP error screen:
PHP Error Description Missing argument 1 for ProjectController::loadModel(), called in /var/www/trackstar/protected/controllers/ProjectController.php on line 55 and defined Source File /var/www/trackstar/protected/controllers/ProjectController.php(165) 00153: $model->attributes=$_GET['Project']; 00154: 00155: $this->render('admin',array( 00156: 'model'=>$model, 00157: )); 00158: } 00159: 00160: /** 00161: * Returns the data model based on the primary key given in the GET variable. 00162: * If the data model is not found, an HTTP exception will be raised. 00163: * @param integer the ID of the model to be loaded 00164: */ 00165: public function loadModel($id) 00166: { 00167: $model=Project::model()->findByPk((int)$id); 00168: if($model===null) 00169: throw new CHttpException(404,'The requested page does not exist.'); 00170: return $model; 00171: } 00172: 00173: /** 00174: * Performs the AJAX validation. 00175: * @param CModel the model to be validated 00176: */ 00177: protected function performAjaxValidation($model) Stack Trace #0 /var/www/trackstar/protected/controllers/ProjectController.php(55): ProjectController->loadModel() #1 /var/www/framework/web/actions/CInlineAction.php(50): ProjectController->actionView() #2 /var/www/framework/web/CController.php(300): CInlineAction->run() #3 /var/www/framework/web/filters/CFilterChain.php(133): ProjectController->runAction() #4 /var/www/framework/web/filters/CFilter.php(41): CFilterChain->run() #5 /var/www/framework/web/CController.php(1049): CAccessControlFilter->filter() #6 /var/www/framework/web/filters/CInlineFilter.php(59): ProjectController->filterAccessControl() #7 /var/www/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter() #8 /var/www/framework/web/CController.php(283): CFilterChain->run() #9 /var/www/framework/web/CController.php(257): ProjectController->runActionWithFilters() #10 /var/www/framework/web/CWebApplication.php(324): ProjectController->run() #11 /var/www/framework/web/CWebApplication.php(121): CWebApplication->runController() #12 /var/www/framework/base/CApplication.php(135): CWebApplication->processRequest() #13 /var/www/trackstar/index.php(13): CWebApplication->run() 2010-09-15 09:03:51 Apache/2.2.14 (Ubuntu) Yii Framework/1.1.4
Now, it would seem that ProjectController actionView would be the cause, but I am unsure why no parameter exists in this method:
/** * Displays a particular model. */ public function actionView() { $issueDataProvider=new CActiveDataProvider('Issue', array( 'criteria'=>array( 'condition'=>'project_id=:projectId', 'params'=>array(':projectId'=>$this->loadModel()->id), ), 'pagination'=>array( 'pageSize'=>1, ), )); $this->render('view',array( 'model'=>$this->loadModel(), 'issueDataProvider'=>$issueDataProvider, )); }
yet a parameter is being requested here:
/** * 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=Project::model()->findByPk((int)$id); if($model===null) throw new CHttpException(404,'The requested page does not exist.'); return $model; }
I must have missed something here. trackstar_dev and trackstar_test are identical, and phpunit tests pass.
Any ideas on where to look?
Thank you!
Attached File(s)
-
ProjectController.php (4.4K)
Number of downloads: 20