Search code examples
phpyii2yii2-advanced-app

Implementing asinfotrack\yii2-wiki Module not found


I'm implementing this package following the instructions found here.

In my config, as instructed, I have

'wiki'=>[
            'class'=>'asinfotrack\yii2\wiki\Module',
            'processContentCallback'=>function($content) {
            //example if you want to use markdown in your wiki
            return Parsedown::instance()->parse($content);
            }
        ]

I am getting an error on wiki/content/view?id=index: Class 'app\modules\wiki\Module' not found - what have I missed?

enter image description here


Solution

  • It looks like there is wrong class namespace used in the package by the developer i.e app\modules\wiki\Module instead of asinfotrack\yii2\wiki\Module to fix this issue without changing the code in the vendor you can set the classmap on top of the project config file( common.php or main.php ) like this

    Yii::$classMap['app\modules\wiki\Module'] = VENDOR_PATH.'/toasinfotrack/yii2-wiki/Module.php';
    

    More details about classmapping in Yii2 can be found here