How to add aliases in yii2?

914 Views Asked by At

I have extracted mdmsoft extension in my backend/extensions/mdm folder. Added aliases in backend config main.php

'aliases' => [
    '@mdm/admin' => '@backend/extensions/mdm'
]

Added module as

[
    'modules' => [
        'admin' => [
            'class' => 'mdm\admin\Module'
        ]
    ]
],

It returns me error.Failed to instantiate component or class "mdm\admin\Module".

How I can manage the config file that MDM works from my backend folder

1

There are 1 best solutions below

0
Taras On BEST ANSWER

Maybe you have to add line below:

Yii::setAlias('@mdm', dirname(dirname(__DIR__)) . '/backend/extensions/mdm');

into common/config/bootstrap.php ?