Monday, 29 June 2015

Yii 2 - Unable to find 'console\controllers\RbacController, RBAC yii rbac/init

I have installed the very latest version of Yii 2.0.4, and while using the Advanced Template with RBAC i got the below issue while running the command yii rbac/init

Exception 'yii\base\UnknownClassException' with message 
'Unable to find 'console\controllers\RbacController' 
in file: /var/www/yii/console/controllers/RbacController.php. Namespace missing?'

To overcome this simply edit the "namespace console\commands;" as   "namespace console\controllers;" in RbacController.php

RbacController - will be inside the console/controllers folder.

Once we set all correctly run yii rbac/init then we will get the values automatically in our migrated tables auth_item and auth_item_child