php - Yii 2: Unable to find a class into the extension 'yii2-admin' -



php - Yii 2: Unable to find a class into the extension 'yii2-admin' -

extension's github project: https://github.com/mdmsoft/yii2-admin

i'm using advanced template of yii2, i've backend, frontend , common folders advanced folder.

the advanced folder on same level of vendor folder.

i've others extensions , working

then installed yii2-admin composer

php composer.phar require mdmsoft/yii2-admin "*"

installation worked well.

into vendor folder i've mdmsoft folder yii2-admin subfolder it.

this actual content of vendor/yiisoft/extensions.php (modified composer installation, haven't manually touched it)

<?php $vendordir = dirname(__dir__); homecoming array ( 'yiisoft/yii2-jui' => array ( 'name' => 'yiisoft/yii2-jui', 'version' => '2.0.0.0', 'alias' => array ( '@yii/jui' => $vendordir . '/yiisoft/yii2-jui', ), ), 'mdmsoft/yii2-admin' => array ( 'name' => 'mdmsoft/yii2-admin', 'version' => '1.0.2.0', 'alias' => array ( '@mdm/admin' => $vendordir . '/mdmsoft/yii2-admin', ), ), );

i added configurations common/config/main.php

<?php homecoming [ ... 'components' => [ ... 'authmanager' => [ 'class' => 'yii\rbac\dbmanager', // or utilize 'yii\rbac\phpmanager' ], ], ];

and these configs adedd backend/config/main.php

'modules' => [ 'admin' => [ 'class' => 'mdm\admin\module', ] ], 'components' => [ 'as access' => [ 'class' => 'mdm\admin\components\accesscontrol', 'allowactions' => [ 'admin/*', // add together or remove allowed actions list ] ], ],

(i omitted useless code in every code block)

i have enabled pretty url. , working.

complete error stack

2014-11-06 17:05:49 [127.0.0.1][-][-][error][reflectionexception] exception 'reflectionexception' message 'class mdm\admin\module not exist' in c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\di\container.php:408 stack trace: #0 c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\di\container.php(408): reflectionclass->__construct('mdm\\admin\\modul...') #1 c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\di\container.php(354): yii\di\container->getdependencies('mdm\\admin\\modul...') #2 c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\di\container.php(147): yii\di\container->build('mdm\\admin\\modul...', array, array) #3 c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\baseyii.php(344): yii\di\container->get('mdm\\admin\\modul...', array, array) #4 c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\module.php(354): yii\baseyii::createobject(array, array) #5 c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\module.php(511): yii\base\module->getmodule('admin') #6 c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\module.php(449): yii\base\module->createcontroller('admin/route') #7 c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\web\application.php(83): yii\base\module->runaction('admin/route', array) #8 c:\xampp\htdocs\advanced\vendor\yiisoft\yii2\base\application.php(375): yii\web\application->handlerequest(object(yii\web\request)) #9 c:\xampp\htdocs\advanced\backend\web\index.php(18): yii\base\application->run() #10 {main}

the problem

if open backend @ /admin got exception

reflectionexception class mdm\admin\module not exist

it's first yii2 app, i've no thought of what's problem , how debug it.

edit 1

i checked c:\xampp\htdocs\vendor\mdmsoft\yii2-admin\module.php , in content there module class definition

class module extends \yii\base\module

edit 2

my first error asaccess set components array. must outside of it, @ same level

now error changed:

class mdm\admin\components\accesscontrol not exist

"i added configurations common/config/main.php" note: !! dont set @ common, set in frontend or backend... console application has no user component , dont need access control.

try adding in backend/config/main right before 'modules'

'vendorpath' => dirname(dirname(__dir__)) . '/vendor', 'extensions' => require(__dir__ . '/../../vendor/yiisoft/extensions.php'), 'components' => [ 'cache' => [ 'class' => 'yii\caching\filecache', ], 'authmanager' => [ 'class' => 'yii\rbac\dbmanager', ], ],

and can't assume whole thing has homecoming in front, whole code like:

return [ 'vendorpath' => dirname(dirname(__dir__)) . '/vendor', 'extensions' => require(__dir__ . '/../../vendor/yiisoft/extensions.php'), 'components' => [ 'cache' => [ 'class' => 'yii\caching\filecache', ], 'authmanager' => [ 'class' => 'yii\rbac\dbmanager', ], ], 'modules'=>[ 'admin' => [ 'class' => 'mdm\admin\module', ], ], 'as access' => [ 'class' => 'mdm\admin\components\accesscontrol', 'allowactions' => [ 'admin/*', ], ], ];

hope helps :d

php yii2

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -