Chapter 9 Adding comment

Hi to all… please help… I’m stuck in chapter 9 regarding Adding comment… here are the errors and I attached the files that are included in adding comments…

View Issue #1

ID 1

Name Name1

Description Descripton1

Type Bug

Status Not Yet Started

Owner Test_User_One

Requester Test_User_One

One comment

jrm:

on September 27, 2011 at 04:51 pm

mokong domeng

Leave a Comment

Fields with * are required.

( ! ) Fatal error: Call to a member function getErrors() on a non-object in D:\xampp\htdocs\yii\framework\web\helpers\CHtml.php on line 1605

Call Stack

Time Memory Function Location

1 0.0008 318952 {main}( ) …\index.php:0

2 0.0470 1879264 CApplication->run( ) …\index.php:13

3 0.0471 1879264 CWebApplication->processRequest( ) …\CApplication.php:158

4 0.0527 2095440 CWebApplication->runController( ) …\CWebApplication.php:136

5 0.0626 2537856 CController->run( ) …\CWebApplication.php:277

6 0.0641 2579800 CController->runActionWithFilters( ) …\CController.php:257

7 0.0670 2658104 CFilterChain->run( ) …\CController.php:283

8 0.0689 2659112 CInlineFilter->filter( ) …\CFilterChain.php:131

9 0.0689 2659176 CController->filterAccessControl( ) …\CInlineFilter.php:59

10 0.0713 2743656 CFilter->filter( ) …\CController.php:1144

11 0.0811 3044320 CFilterChain->run( ) …\CFilter.php:41

12 0.0811 3044320 CController->runAction( ) …\CFilterChain.php:134

13 0.0811 3044320 CInlineAction->runWithParams( ) …\CController.php:300

14 0.0812 3044928 CAction->runWithParamsInternal( ) …\CInlineAction.php:48

15 0.0813 3045576 ReflectionMethod->invokeArgs( ) …\CAction.php:104

16 0.0813 3045592 IssueController->actionView( ) …\IssueController.php:0

17 0.1718 5297792 CController->render( ) …\IssueController.php:59

18 0.1718 5297856 CController->renderPartial( ) …\CController.php:779

19 0.1725 5298104 CBaseController->renderFile( ) …\CController.php:866

20 0.1726 5298168 CBaseController->renderInternal( ) …\CBaseController.php:88

21 0.1732 5361848 require( ‘D:\xampp\htdocs\trackstar\protected\views\issue\view.php’ ) …\CBaseController.php:119

22 0.2859 7354760 CController->renderPartial( ) …\view.php:60

23 0.2865 7354960 CBaseController->renderFile( ) …\CController.php:866

24 0.2865 7355024 CBaseController->renderInternal( ) …\CBaseController.php:88

25 0.2869 7406328 require( ‘D:\xampp\htdocs\trackstar\protected\views\comment\_form.php’ ) …\CBaseController.php:119

26 0.2905 7546104 CActiveForm->errorSummary( ) …\_form.php:10

27 0.2905 7546288 CHtml::errorSummary( ) …\CActiveForm.php:507

anyone from yii community? I would appreciate your help… Nobody is giving attention to what I have posted… :-[

Hi! I’ll give my attention =). So… can you send me the model class?

Ok sir… :) here are the model files.

You need to pass the $comment object to to view.




public function actionView($id)   

 {

    //$issue=$this->loadModel($id,true);

    $issue=$this->loadModel($id);

    $comment=$this->createComment($issue);	

		

    $this->render('view',array(		

        'model'=>$issue,

        'comment'=>$comment,

    ));

}




Cheers,

Matt

I got it…

the code should be

	$comment = new Comment();


	$this->renderPartial('/comment/_form',array(


		'model'=>$comment,


	)); ?>

Not according to the book - p220

thank you very much waterloomatt, youre code also works, and I find a other way that area also working… cheers my friend :)

Its not according to book sir, I redeclared $comment = new Comment(); in the view file.

hi friends,

         i need full step details for this commnet creation...








 Please send the each step of this creation...  ptsuthakar90@gmail.com