Associating existing roles and permissions

I’m attempting to implement Yii2 RBAC (‘authManager’ => [‘class’ => ‘yii\rbac\DbManager’,]). I’ve got a series of permissions already created and a series of roles already created. I just need to associate the two. I’ve got a console/controllers/RbacController set up starting like this:

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

     $admin = getRole("admin");

     $friend = getRole("friend");

     $author = getRole("author");

     $user = getRole("user");

Then, I have a series of statements like this:

     $createAssist = getPermission("createAssist");

     $auth->addChild($admin, $createAssist);

The problem is that, no matter what use statements I incorporate, I get an error message saying "Call to undefined function." It seems that both getRole() and getPermission() are undefined. Surely these functions, listed in the API documentation as "public" are accessible.

I’ve tried these use statements:

use Yii;

use yii\console\Controller;

use yii\rbac\DbManager;

use yii\rbac\Permission;

use yii\rbac\Item;

use yii\rbac\BaseManager;

use yii\rbac\Role;

None of them have any effect on the error message. getRole() and getPermission() are both undefined with all of the use statements.

Yii2 RBAC seems to be more than a little squirrelly. I hope someone can help me out here.

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

     $admin = $auth->getRole("admin");


Thanks. Dumb mistake on my part. That’s gotten me quite a ways.