Building Authorization Data problem

I use this code via command line but I have the error call to a member function createRolle on null on line 14.

The command line is yii rbac/init as

namespace app\commands;

use Yii;

use yii\console\Controller;

class RbacController extends Controller


    public function actionInit()


        $auth = Yii::$app->authManager;

        $admin = $auth->createRole('admin');


        $mod= $auth->createRole('moderator');



        // Assign roles to users. 1 and 2 are IDs returned by IdentityInterface::getId()

        // usually implemented in your User model.

      //  $auth->assign($author, 2);

       // $auth->assign($admin, 1);



That’s because you haven’t configured your authManager.