Problem Adding Base Class First Before Adding Sub Class

from view file, I wanted to pass the values of priority and request_type to be used in saving parentModel.

In this part, i’m having problem passing these values also. what would be the best option to do?

I tried using createUrl however controller cannot recognize it (or i’m not doing it right).


	public function actionCreate()


		$childModel=new RequestDetails;

		$childModel->request_number = $_GET['request_number'];

		$priority = $_GET['priority'];

		$request_type = $_GET['request_type'];

		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);






				$parentModel = Request::model()->findByPk($childModel->request_number);

				if ($parentModel === null) {

					$parentModel = new Request;

					$parentModel->request_number = $childModel->request_number;

					$parentModel->request_type = $request_type;

					$parentModel->priority = $priority;










Please help. Thanks.

can you explain what you trying to achieve

from my view form I will set there the parentModel->priority and parentModel->request_type values and request_number which is auto-generated

then I created a url to access the create action of childModel controller along with the parentModel->request_number

I wanted to pass parentModel->priority and parentModel->request_type values also to childModel controller because it will be needed when saving the parentModel

if there is no corresponding parentModel created yet (parentModel HAS_MANY relationship to childModel, request_number is foreign_key to childModel) when creating a childModel, it will create first a parentModel then create a childModel

I am using this code to find if there is an existing parentModel using the request_number

$parentModel = Request::model()->findByPk($childModel->request_number);

you may refer to my first post for my childModel controller create code


  1. What is the best way to pass values from view to different controller other than createUrl?

  2. checking from my controller code, am I doing it right?

Thanks in advance.

Sessions? &

Edit: Yeah well that means you run first… a controller action anyway. So it’s not really a solution to your concern. You only want to pass a value (that is not in a form) to a given controller?

Dear Friend

I am not able to comprehend what exactly you want.

Kindly check whether the follwing is helpful.

We have got a controller,Test.

We have a view link.





echo CHtml::link(CHtml::encode('doSomething'),array('test/something','param'=>$param,'value'=>$value,'name'=>$name));


public function actionSomething($param,$value,$name) {

		if($_GET==NULL) $this->render('link');


                        //Do something with $param,$value and $name.



NOTE: By default all GET parameters are available for action parameter binding in a controller method.