demos/blog/protected/models/Post.php
public function addComment($comment)
	{
		if(Yii::app()->params['commentNeedApproval'])
			$comment->status=Comment::STATUS_PENDING;
		else
			$comment->status=Comment::STATUS_APPROVED;
		$comment->post_id=$this->id;
		return $comment->save();
	}
public function addComment($comment)
	{
		if(Yii::app()->params['commentNeedApproval'])
			$comment->status=Comment::STATUS_PENDING;
		else
			$comment->status=Comment::STATUS_APPROVED;
		$comment->post_id=$this->id;
		return $comment->save();
	}
public function addComment ( $ comment ) { if ( Yii :: app ( ) -> params [ 'commentNeedApproval' ] ) $ comment -> status = Comment :: STATUS_PENDING ; else $ comment -> status = Comment :: STATUS_APPROVED ; $ comment -> post_id = $ this -> id ; return $ comment -> save ( ) ; }
Adds a new comment to this post.
This method will set status and post_id of the comment accordingly.
@param Comment the comment to be added
@return boolean whether the comment is saved successfully
Adds a new comment to this post . This method will set status and post_id of the comment accordingly .