yiiyii2yii2-advanced-appyii-extensionsyii-modules

How to add aliases in yii2?


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


Solution

  • Maybe you have to add line below:

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

    into common/config/bootstrap.php ?