Override controller of module

Hi,

I’m using the yii2-admin module and would like to extend the assignment controller to add additional actions. This controller is located in /vendor/mdmsoft/yii2-admin/controllers/AssignmentController.php. I would like to keep the third-party plugin in tact, that is no modifications in the /vendor folder, to be able to update this module without losing the modifications.

I created my own assignment controller and put in the folder /frontend/web/themes/modules/yii2-admin/controllers/AssignmentController.php’ and set its namespace to ‘frontend\controllers\admin’. In my main.php configuration I have:




'modules' => [

        'admin' => [

            'class' => 'mdm\admin\Module',

            'controllerMap' => [

                'assignment' => [

                    'class' => 'frontend\controllers\admin\AssignmentController',

...



When I browse to /index.php?r=admin/assignment I get the following error: "Class frontend\controllers\admin\AssignmentController does not exist".

What am I doing wrong here?

Thanks!

[color="#1C2837"][size="2"]Maybe you wront.[/size][/color]

[color="#1C2837"][size="2"]/frontend/web/themes/modules/yii2-admin/controllers/AssingmentController.php[/size][/color]

[color="#008800"]‘class’[/color] [color="#666600"]=>[/color] [color="#008800"]‘frontend\controllers\admin\AssignmentController’[/color][color="#666600"],[/color]

[color="#1C2837"][size="2"]AssingmentController!=[/size][/color][color="#008800"][size="2"]AssignmentController[/size][/color]

[color="#008800"] [/color]

[size="2"]Assi( and ngm or gnm) .[/size]

Thanks for pointing that out, but unfortunately I made a typo only when writing this post, my folder structure is correct (spelling Assignment instead of Assingment). I will correct my first post and I’m still looking for a solution.