Missing Argument 1 For Mycontroller::loadmodel()

Hello.

I have problem with passing $id to function loadModel($id), which is executed inside my own filter "filterViewOwn". I have error: Missing argument 1 for PostController::loadModel(). Does anyone can help me? How can i pass this $id? Thanks, greetings.




	public function filters()

	{

		return array( 

                        'viewOwn + view',

                        'rights',                        

			);

	}


	public function filterViewOwn($filterChain)

	{

		$post=$this->loadModel();

		// Remove the 'rights' filter if the user is updating an own post

		// and has the permission to do so.

		if(Yii::app()->user->checkAccess('PostViewOwn', array('userid'=>$post->author_id)))

		$filterChain->removeAt(1);

		$filterChain->run();

	} 


	public function loadModel($id)

	{

		$model=Post::model()->findByPk($id);

		if($model===null)

			throw new CHttpException(404,'The requested page does not exist.');

		return $model;

	}



Dear Friend

You can get the GET or POST parameters like the following way.




$id=Yii::app()->request->getParam('id');

if(isset($id))

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



I applied this in CController::accessRule().

It is nice to see that you are applying it in filters.

GoodLuck!

Many thanks:) You helped me much:) Greetings from Poland:)

Tom