src/Rbac/DbManager.php
protected function removeAllItems($type)
    {
        if (!$this->supportsCascadeUpdate()) {
            $namesPromise = (new Query())
                ->select(['name'])
                ->from($this->itemTable)
                ->where(['type' => $type])
                ->column($this->db);
        } else {
            $namesPromise = new Reaction\Promise\Promise(function($r) {
                $r([]);
            });
        }

        return $namesPromise
            ->then(function($names) use ($type) {
                $promises = [];
                if (!$this->supportsCascadeUpdate()) {
                    if (empty($names)) {
                        return resolve(true);
                    }
                    $key = $type == Item::TYPE_PERMISSION ? 'child' : 'parent';
                    $promises[] = $this->db->createCommand()
                        ->delete($this->itemChildTable, [$key => $names])
                        ->execute();
                    $promises[] = $this->db->createCommand()
                        ->delete($this->assignmentTable, ['item_name' => $names])
                        ->execute();
                }
                $promises[] = $this->db->createCommand()
                    ->delete($this->itemTable, ['type' => $type])
                    ->execute();
                return allInOrder($promises);
            })->then(function() {
                return $this->invalidateCache();
            });
    }
protected function removeAllItems($type)
    {
        if (!$this->supportsCascadeUpdate()) {
            $namesPromise = (new Query())
                ->select(['name'])
                ->from($this->itemTable)
                ->where(['type' => $type])
                ->column($this->db);
        } else {
            $namesPromise = new Reaction\Promise\Promise(function($r) {
                $r([]);
            });
        }

        return $namesPromise
            ->then(function($names) use ($type) {
                $promises = [];
                if (!$this->supportsCascadeUpdate()) {
                    if (empty($names)) {
                        return resolve(true);
                    }
                    $key = $type == Item::TYPE_PERMISSION ? 'child' : 'parent';
                    $promises[] = $this->db->createCommand()
                        ->delete($this->itemChildTable, [$key => $names])
                        ->execute();
                    $promises[] = $this->db->createCommand()
                        ->delete($this->assignmentTable, ['item_name' => $names])
                        ->execute();
                }
                $promises[] = $this->db->createCommand()
                    ->delete($this->itemTable, ['type' => $type])
                    ->execute();
                return allInOrder($promises);
            })->then(function() {
                return $this->invalidateCache();
            });
    }
Removes all auth items of the specified type.
@param int $type the auth item type (either Item::TYPE_PERMISSION or Item::TYPE_ROLE)
@return ExtendedPromiseInterface when finished