quick question about method and class

Hello,

I just have a quick question.

I am in the z controller and would like to call y method in y object.

I have tried that way but it does not work :

So in Z controller:

y = new y;

y->loady(id)->delete();

I have the message that the method is not exists.

How can I call y methods from z controller?

$y=new Y;

$y->methodName();

Yes, I have tried that.

Here is the following code.

   public function actiondeleteLanguage()


   {





      if(Yii::app()->request->isAjaxRequest)


      {		


		$cv_langue = new cv_langue;


		$cv_langue->loadcv_langue($_POST['cv_texte']['id_cv_langue'])->delete();


		{


		$cv_langue=cv_langue::model()->findAll();


		foreach($cv_langue as $value){		


		echo '<option value="'.$value->id_langue.'">'.$value->titre.'</option>';


		}


		}


      }


   }   

But I have the following message :

cv_langue does not have a method named loadcv_langue.

The error message is clear. Your cv_langue class doesn't have a method named "loadcv_langue".

The method is exisiting that the point I do not understand…

In my cv_langue controler:



	public function loadcv_langue($id=null)


	{


		if($this->_cv_langue===null)


		{


			if($id!==null || isset($_GET['id']))


				$this->_cv_langue=cv_langue::model()->findbyPk($id!==null ? $id : $_GET['id']);


			if($this->_cv_langue===null)


				throw new CHttpException(500,'The requested cv_langue does not exist.');


		}


		return $this->_cv_langue;


	}


your method is defined in controller, but you are calling it on the model

Ok sorry I understand now.

Thank you Qiang!