mdmsoft / yii2-admin

Auth manager for Yii2 (RBAC Manager)
GNU General Public License v3.0
1.16k stars 574 forks source link

ReflectionException #88

Open puppyceceyoyo opened 9 years ago

puppyceceyoyo commented 9 years ago

I have this error when I access the /admin page. I put the configuration under /config/web.php. Is that correct for basic template? Can someone pls help?

ReflectionException
Class mdm\admin\components\AccessControl does not exist

1. in /home/myfolder/basic/vendor/yiisoft/yii2/di/Container.php
mdmunir commented 9 years ago

is it success install? please check folder vendor/mdmsoft/yii2-admin

puppyceceyoyo commented 9 years ago

I install it manually. the AccessControl.php is there inside vendor/mdmsoft/yii2-admin/components

mdmunir commented 9 years ago

If you install manual, you should add alias of path vendor/mdmsoft/yii2-admin. in your config, add

'aliases' => [
    '@mdm/admin' => '@vendor/mdmsoft/yii2-admin',
]

http://www.yiiframework.com/doc-2.0/guide-concept-aliases.html

puppyceceyoyo commented 9 years ago

i already have added the alias after i installed manually.

puppyceceyoyo commented 9 years ago

I put in /vendor/yiisoft/extensions.php, is that correct?

  'mdmsoft/yii2-admin' => 
  array (
'name' => 'mdmsoft/yii2-admin',
'version' => '*',
'alias' => 
array (
  '@mdm/admin' => $vendorDir . '/mdmsoft/yii2-admin',
),  

),

mdmunir commented 9 years ago

i am not sure. you should not change content of vendor/yiisoft/extensions.php. If you need add alias manually, add it via Application::$aliases or via Yii::setAlias()

puppyceceyoyo commented 9 years ago

oh ok, but even I add the alias under aliases in my /config/web.php, it still the same error.

puppyceceyoyo commented 9 years ago

i installed using composer now, and configured all the things, now it gives me another ReflectionException.

ReflectionException Class user does not exist

ASlatius commented 9 years ago

I had the same issue; For me the problem was that I added the 'as access' config section to the common/config.php and because of that the console application now also suddenly needs a user component which it doesn't have. I added the 'as access' section to the front/backend config only. The 'modules' part in can be left in the common config.

liupangzi commented 9 years ago

@Hommer101 i'm using yii2 basic and i got the same problem. i found i have a directory named "mdm\admin\classes\" instead of "mdm\admin\components\", and it also has a file names "AccessControl.php". so i changed the config file from

        'class' => 'mdm\admin\components\AccessControl',

to

        'class' => 'mdm\admin\classes\AccessControl',

and the error has gone.

however, i got a new problem now.

The file or directory to be published does not exist: /var/www/zhixing/admin/vendor/bower/angular

what a tough day.

mdmunir commented 9 years ago

@liupangzi Version 3.x totally different with previous version. Its not easy install without composer. prefer download 2.x version.

wuzhc commented 8 years ago

I change 'class' => 'mdm\admin\components\AccessControl' to 'class' => 'mdm\admin\classes\AccessControl' and it run, but i don not known how to use it

galihazizif commented 7 years ago

i move 'mdm\admin\components\AccessControl' to my app components 'app\components\AccessControl' and adjust several change. It works.

queenjjz commented 5 years ago

yes, i move it to the directory 'backend\components',it works.