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();
}