Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Binding Urls With Action

$
0
0
Hi all,

I am trying to create CRUD operations to a table with composite keys,
In my controller i have overridden the conventional set of functions to accept two parameters. The create action gets executed but my view, update and deletion functions from CGridview doesnt work.

in my Controller
public function actionView($subjectName, $teacher_id)
{
   $model=$this->loadModel($subjectName, $teacher_id);
   $this->render('view',array('model'=>$model));
}

public function loadModel($subjectName, $teacher_id)
{
$model=  Teacherteachsub::model()->findByPk(array('subjectName'=>$subjectName, 'subjectTeacherId'=>$teacher_id));

if($model==null)
   throw new CHttpException(404,'The requested page does not exist.');
return $model;
}


In my admin.php i bind the current selected values to the URL as:-
<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'resultgrid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'columns' => array(
        'subjectName',
        'subjectTeacherId',
        array(
            'class' => 'CButtonColumn',
            'template' => '{view}{update}{delete}',
            'buttons' => array
                (
                'view' => array
                    (
                    'url' =>
                    'Yii::app()->createUrl("teacherteachsub/view/",array("subjectName"=>$data->subjectName, "subjectTeacherId"=>$data->subjectTeacherId))',
                ),
            ),
        ),
    ),
));

?>


What i get is :

Quote

Error 400 Your request is invalid.


I used the debugger and it gives a similar error. As far as i can understand the way i have called the action from URL is correct, have i missed something?

Any help to this right is greatly appreciated, Thanks for your time!

Cheerz! :)

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>