yii\mongodb\rbac\MongoDbManager::removeAllItems PHP Method

removeAllItems() protected method

Removes all auth items of the specified type.
protected removeAllItems ( integer $type )
$type integer the auth item type (either Item::TYPE_PERMISSION or Item::TYPE_ROLE)
    protected function removeAllItems($type)
    {
        $rows = (new Query())->select(['name'])->from($this->itemCollection)->where(['type' => $type])->all($this->db);
        if (empty($rows)) {
            return;
        }
        $names = ArrayHelper::getColumn($rows, 'name');
        $this->db->getCollection($this->assignmentCollection)->remove(['item_name' => $names]);
        $this->db->getCollection($this->itemCollection)->remove(['type' => $type]);
        $this->db->getCollection($this->itemCollection)->update([], ['$pull' => ['parents' => ['$in' => $names]]], ['multi' => true]);
        $this->invalidateCache();
    }