Yii Framework Forum: Modify By Create Or Delete The Id In Url - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Modify By Create Or Delete The Id In Url Rate Topic: -----

#1 User is offline   Miguel Garcia 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 06-November 12

Posted 14 February 2013 - 11:24 AM

Hello
In my application, the controller needs to receive an id to give a high, simply because I take the parent recording information, and then do the render:

public function actionCreateHijo($id=null){
	        if (isset($id))
	                $model=$this->loadModel($id);
	        else 
		        $model=new CTabMenu;
		if(isset($_POST['CTabMenu']))
		{
			$model->attributes=$_POST['CTabMenu'];
			if($model->save())
				$this->redirect(array('view','id'=>$model->id));
		}
		$model1=new CTabMenu;
		$model1->id_idioma=$model->id_idioma;
		$model1->orden=10;
		$model1->id_menu_origen=$model->id_menu;
		$model1->id_menuBase=$model->id_menu;
		$model1->area=$model->area;
		$model->unsetAttributes();
		$this->render('create',array(
				'model'=>$model1,
		));


. The problem I have is that when I go to record, the id parameter in the url and still due, instead of recording a new record, modify the parent

I can do away the ID parameter of the URL?, Or? You think of a better way to do it?
0

#2 User is offline   yigor 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 14-February 13
  • Location:Brazil

Posted 16 February 2013 - 07:31 PM

You way is the best.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users