Remove category

@param \Amulen\ClassificationBundle\Entity\Category $category
494367
public function removeCategory(\Amulen\ClassificationBundle\Entity\Category $category)
    {
        $this->categories->removeElement($category);
    }
1063361
public static function delete_categories($categories) {
        global $CFG, $DB;
        require_once($CFG->dirroot . "/course/lib.php");

        // Validate parameters.
        $params = self::validate_parameters(self::delete_categories_parameters(), array('categories' => $categories));

        $transaction = $DB->start_delegated_transaction();

        foreach ($params['categories'] as $category) {
            $deletecat = core_course_category::get($category['id'], MUST_EXIST);
            $context = context_coursecat::instance($deletecat->id);
            require_capability('moodle/category:manage', $context);
            self::validate_context($context);
            self::validate_context(get_category_or_system_context($deletecat->parent));

            if ($category['recursive']) {
                // If recursive was specified, then we recursively delete the category's contents.
                if ($deletecat->can_delete_full()) {
                    $deletecat->delete_full(false);
                } else {
                    throw new moodle_exception('youcannotdeletecategory', '', '', $deletecat->get_formatted_name());
                }
            } else {
                // In this situation, we don't delete the category's contents, we either move it to newparent or parent.
                // If the parent is the root, moving is not supported (because a course must always be inside a category).
                // We must move to an existing category.
                if (!empty($category['newparent'])) {
                    $newparentcat = core_course_category::get($category['newparent']);
                } else {
                    $newparentcat = core_course_category::get($deletecat->parent);
                }

                // This operation is not allowed. We must move contents to an existing category.
                if (!$newparentcat->id) {
                    throw new moodle_exception('movecatcontentstoroot');
                }

                self::validate_context(context_coursecat::instance($newparentcat->id));
                if ($deletecat->can_move_content_to($newparentcat->id)) {
                    $deletecat->delete_move($newparentcat->id, false);
                } else {
                    throw new moodle_exception('youcannotdeletecategory', '', '', $deletecat->get_formatted_name());
                }
            }
        }

        $transaction->allow_commit();
    }
624705
public function make(ICategory $category)
    {
        //$category->setResponse($this->response->view('admin.categorys.view', compact('category')));
        $category->setResponse($this->response->view(\OogleeBConfig::get('config.category_view.view'), compact('category')));
    }
1276308
public function setCategory($category)
    {
        $allowedValues = $this->getCategoryAllowableValues();
        if (!in_array($category, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'category', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['category'] = $category;

        return $this;
    }
933180
public function edit(Category $category)
    {
        return view('dashboard.sections.categories.edit', [
            'hasParent' => ! is_null($category->parent),
            'parents' => Category::parents()->get(),
            'category' => $category->load('parent'),
        ]);
    }
706588
protected function setCategory(CategoryInterface $category)
    {
        $this->category = $category;
        $this->attributeKeysAndControllers = null;
        $this->csvHeader = null;

        return $this;
    }
517288
public void removeCategory(String categoryPath) {

        m_searchObject.removeCategory(categoryPath);
        m_searchObjectChanged = true;
        ValueChangeEvent.fire(this, m_searchObject);
    }
681276
public function setCategory(\Innova\LexiconBundle\Entity\Category $category = null)
    {
        $this->category = $category;

        return $this;
    }
994662
public function setCategories($categories)
    {
        foreach ($categories as $key => $name) {
            $this->_categories[$key] = $name;
        }
    }
577919
def remove_token_from_category(category, token)
      cat_data(category)[:tokens][token] -= 1
      delete_token_from_category(category, token) if cat_data(category)[:tokens][token] < 1
      cat_data(category)[:total_tokens] -= 1
      delete_category(category) if cat_data(category)[:total_tokens] < 1
    end
1364137
public function delete_category(category_controller $category) : bool {
        $category = $this->validate_category($category);
        $result = api::delete_category($category);
        $this->clear_configuration_cache();
        return $result;
    }
369132
public function update(DocumentCategory $category)
    {
        $attributes = request()->validate(DocumentCategory::$rules, DocumentCategory::$messages);

        $category = $this->updateEntry($category, $attributes);

        return redirect_to_resource();
    }
271610
public function removeModule(string $category, string $class): self {
        if (isset($this->modules[$category])) {
            $key = array_search($class, $this->modules[$category]);

            if ($key !== false) {
                unset($this->modules[$category][$key]);
            }
        }

        return $this;
    }
350785
public function remove($category, $key = null)
    {
        if ($key === null) {
            $this->dbDelete($category);

            if (isset($this->items[$category])) {
                unset($this->items[$category]);
            }
        }

        if (is_string($key)) {
            $this->dbDelete($category, $key);

            if (isset($this->items[$category][$key])) {
                unset($this->items[$category][$key]);
            }
        }

        if (is_array($key)) {
            foreach ($key as $idx => $val) {
                $this->remove($category, $key);
            }
        }

    }
2342
public function edit(Category $category)
    {
        $categories = $this->category->all()->nest()->listsFlattened('name');

        return view('product::admin.categories.edit', compact('category', 'categories'));
    }
903189
public function addCategory(\Hexmedia\ContentBundle\Entity\Category $category)
    {
        $this->categories[] = $category;

        return $this;
    }
1017758
public function category($category)
    {
        $categoryId = NotificationCategory::getIdByCategory($category);
        $this->setNotificationData('category_id', $categoryId);

        return $this;
    }