[name]控制器及其行为没有名为“createReturnableUrl”

时间:2015-06-24 12:38:21

标签: php yii

在Yii工作,我得到错误

  

SystemManagementController及其行为没有方法或   闭包名为“createReturnableUrl”

我找不到任何解决方法。它发生在我添加之后:

array(
        'class' => 'CButtonColumn',
            //'viewButtonUrl' => '$this->grid->controller->createReturnableUrl("view",array("id"=>$data->id))',
            'updateButtonUrl' => '$this->grid->controller->createReturnableUrl("update",array("id"=>$data->id))',
            'deleteButtonUrl' => '$this->grid->controller->createReturnableUrl("delete",array("id"=>$data->id))',
            //'deleteConfirmation' => Yii::t('app', 'Are you sure to delete this item?'),
        ),

到:

<?php
    //The following lines needs to be moved to the controller to sepparate the view from the controllers.
    $model = new CActiveDataProvider('User');

    //The following line should be set by the controller. Containing the names of the colums in a chosen language.
    /**/

    $colums = array(
        'login',
        'name_first',
        'name_last',

        //'password',
        'email',
        'is_active',
        //'sortorder',
        array(
        'class' => 'CButtonColumn',
            //'viewButtonUrl' => '$this->grid->controller->createReturnableUrl("view",array("id"=>$data->id))',
            'updateButtonUrl' => '$this->grid->controller->createReturnableUrl("update",array("id"=>$data->id))',
            'deleteButtonUrl' => '$this->grid->controller->createReturnableUrl("delete",array("id"=>$data->id))',
            //'deleteConfirmation' => Yii::t('app', 'Are you sure to delete this item?'),
        ),
    );


    $this->widget('zii.widgets.grid.CGridView', array(
        'dataProvider' => $model,
        'columns' => $colums,
        'filter' => $model->model)
    );
?>

当我删除那段代码时,没有问题,一切正常,但是当我添加该行时,它会给我错误。

我也在不同的班级使用那一行,在那里我没有遇到问题,我怎么能摆脱这个呢?

1 个答案:

答案 0 :(得分:0)

看起来控制器不知道createReturnableUrl。从我用Google搜索的是你可以附加的yii行为,你确定你为SystemManagementController正确地附加了行为吗?看看使用相同代码的所有其他控制器是否附加了该行为,也许这个没有。