robregonm / yii2-auth

Yii 2 User Authentication & Role Based Access Control (RBAC) Module
BSD 3-Clause "New" or "Revised" License
77 stars 37 forks source link

Cannot open index, got invalid table name #40

Open pace-noge opened 9 years ago

pace-noge commented 9 years ago

Database Exception – yii\db\Exception

SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' The SQL being executed was: SHOW FULL COLUMNS FROM `` Error Info: Array ( [0] => 42000 [1] => 1103 [2] => Incorrect table name '' ) ↵ Caused by: PDOException

SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''

requested query SHOW FULL COLUMNS FROM ``

config: 'modules' => [ 'gii' => 'yii\gii\Module', 'auth' => [ 'class' => 'auth\Module', 'layout' => '//homepage', // Layout when not logged in yet 'layoutLogged' => '//main', // Layout for logged in users 'attemptsBeforeCaptcha' => 3, // Optional 'supportEmail' => 'support@mydomain.com', // Email for notifications 'passwordResetTokenExpire' => 3600, // Seconds for token expiration 'superAdmins' => ['admin'], // SuperAdmin users 'tableMap' => [ // Optional, but if defined, all must be declared 'User' => 'user', 'UserStatus' => 'user_status', 'ProfileFieldValue' => 'profile_field_value', 'ProfileField' => 'profile_field', 'ProfileFieldType' => 'profile_field_type', ], ], ],

components: 'user' => [ 'class' => 'auth\components\User', ], 'authManager' => [ 'class' => 'yii\rbac\DbManager', 'ruleTable' => 'AuthRule', 'itemTable' => 'AuthItem', 'itemChildTable' => 'AuthItemChild', 'assignmentTable' => 'AuthAssignment', 'defaultRoles' => ['guest'], ],

20tech commented 9 years ago

I Had this Problem too, I Do it :: define Modules in config\web.php 'modules' =>[ 'auth' => [ 'class' => 'auth\Module', // 'layout' => '/auth/default/login', // Layout when not logged in yet // 'layoutLogged' => '/auth/default/logout', // Layout for logged in users 'attemptsBeforeCaptcha' => 3, // Optional 'supportEmail' => 'support@mydomain.com', // Email for notifications 'passwordResetTokenExpire' => 3600, // Seconds for token expiration 'superAdmins' => ['admin'], // SuperAdmin users 'tableMap' => [ // Optional, but if defined, all must be declared 'User' => 'user', 'UserStatus' => 'user_status', 'ProfileFieldValue' => 'profile_field_value', 'ProfileField' => 'profile_field', 'ProfileFieldType' => 'profile_field_type', ], ], ], and this in components : 'user' => [ 'class' => 'auth\components\User', 'identityClass' => 'auth\models\User', // just replace your identityClass 'enableAutoLogin' => true, ], and Delete this config from console.php