src/Rbac/DbManager.php
public function assign($role, $userId)
    {
        $assignment = new Assignment([
            'userId' => $userId,
            'roleName' => $role->name,
            'createdAt' => time(),
        ]);

        return $this->db->createCommand()
            ->insert($this->assignmentTable, [
                'user_id' => $assignment->userId,
                'item_name' => $assignment->roleName,
                'created_at' => $assignment->createdAt,
            ])
            ->execute()
            ->then(
                function() use ($assignment, $userId) {
                    unset($this->_checkAccessAssignments[(string)$userId]);
                    return $assignment;
                }
            );
    }
public function assign($role, $userId)
    {
        $assignment = new Assignment([
            'userId' => $userId,
            'roleName' => $role->name,
            'createdAt' => time(),
        ]);

        return $this->db->createCommand()
            ->insert($this->assignmentTable, [
                'user_id' => $assignment->userId,
                'item_name' => $assignment->roleName,
                'created_at' => $assignment->createdAt,
            ])
            ->execute()
            ->then(
                function() use ($assignment, $userId) {
                    unset($this->_checkAccessAssignments[(string)$userId]);
                    return $assignment;
                }
            );
    }
{@inheritdoc}