Delete articles from category (from oxobject2category).

@param array  $articles
@param string $categoryID
346591
protected function removeCategoryArticles($articles, $categoryID)
    {
        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $prodIds = implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($articles));

        $delete = "delete from oxobject2category ";
        $where = $this->getRemoveCategoryArticlesQueryFilter($categoryID, $prodIds);


        $sQ = $delete . $where;
        $db->execute($sQ);

        // updating oxtime values
        $this->_updateOxTime($prodIds);
    }
235445
public static function Delete(int $id, $drop_children = false)
    {
        return self::$Categories->delete($id, $drop_children);
    }
66749
public function removeCategories(Collection $categories)
    {
        foreach ($categories as $category) {
                $this->removeCategory($category);
        }

        return $this;
    }
879482
public function remove(Category $category)
    {
        $category->term->delete();
        $category->delete();

        Alert::info(__('Category was removed'));

        return redirect()->route('platform.systems.category');
    }
915896
public function destroy(Category $category)
    {
        $this->category->destroy($category);

        return redirect()->route('admin.product.category.index')
            ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::categories.title.categories')]));
    }
908912
public function canDelete($category_group_id)
    {
        $sql = 'SELECT category_id FROM category WHERE category_group_id=?';
        $result = $this->db->fetchColumn($sql, array($category_group_id));
        return empty($result);
    }
182472
def __remove_category(self, id):
        """"""

        affected_query = """
            SELECT id
              FROM facts
             WHERE activity_id in (SELECT id FROM activities where category_id=?)
        """
        affected_ids = [res[0] for res in self.fetchall(affected_query, (id,))]

        update = "update activities set category_id = -1 where category_id = ?"
        self.execute(update, (id, ))

        self.execute("delete from categories where id = ?", (id, ))

        self.__remove_index(affected_ids)
726805
public function DeleteCategory($CategoryID = FALSE) {
      // Check permission
      $this->Permission('Garden.Settings.Manage');
      
      // Set up head
      $this->AddJsFile('categories.js');
      $this->Title(T('Delete Category'));
      $this->AddSideMenu('vanilla/settings/managecategories');

      // Get category data
      $this->Category = $this->CategoryModel->GetID($CategoryID);
      
      
      if (!$this->Category) {
         $this->Form->AddError('The specified category could not be found.');
      } else {
         // Make sure the form knows which item we are deleting.
         $this->Form->AddHidden('CategoryID', $CategoryID);
         
         // Get a list of categories other than this one that can act as a replacement
         $this->OtherCategories = $this->CategoryModel->GetWhere(
            array(
               'CategoryID <>' => $CategoryID,
               'AllowDiscussions' => $this->Category->AllowDiscussions, // Don't allow a category with discussion to be the replacement for one without discussions (or vice versa)
               'CategoryID >' => 0
            ),
            'Sort'
         );
         
         if (!$this->Form->AuthenticatedPostBack()) {
            $this->Form->SetFormValue('DeleteDiscussions', '1'); // Checked by default
         } else {
            $ReplacementCategoryID = $this->Form->GetValue('ReplacementCategoryID');
            $ReplacementCategory = $this->CategoryModel->GetID($ReplacementCategoryID);
            // Error if:
            // 1. The category being deleted is the last remaining category that
            // allows discussions.
            if ($this->Category->AllowDiscussions == '1'
               && $this->OtherCategories->NumRows() == 0)
               $this->Form->AddError('You cannot remove the only remaining category that allows discussions');
            
            /*
            // 2. The category being deleted allows discussions, and it contains
            // discussions, and there is no replacement category specified.
            if ($this->Form->ErrorCount() == 0
               && $this->Category->AllowDiscussions == '1'
               && $this->Category->CountDiscussions > 0
               && ($ReplacementCategory == FALSE || $ReplacementCategory->AllowDiscussions != '1'))
               $this->Form->AddError('You must select a replacement category in order to remove this category.');
            */
            
            // 3. The category being deleted does not allow discussions, and it
            // does contain other categories, and there are replacement parent
            // categories available, and one is not selected.
            /*
            if ($this->Category->AllowDiscussions == '0'
               && $this->OtherCategories->NumRows() > 0
               && !$ReplacementCategory) {
               if ($this->CategoryModel->GetWhere(array('ParentCategoryID' => $CategoryID))->NumRows() > 0)
                  $this->Form->AddError('You must select a replacement category in order to remove this category.');
            }
            */
            
            if ($this->Form->ErrorCount() == 0) {
               // Go ahead and delete the category
               try {
                  $this->CategoryModel->Delete($this->Category, $this->Form->GetValue('ReplacementCategoryID'));
               } catch (Exception $ex) {
                  $this->Form->AddError($ex);
               }
               if ($this->Form->ErrorCount() == 0) {
                  $this->RedirectUrl = Url('vanilla/settings/managecategories');
                  $this->InformMessage(T('Deleting category...'));
               }
            }
         }
      }
      
      // Render default view
      $this->Render();
   }
1373664
public function delete($category, $attribute, $entryID) {
        $this->api->request(
            'cmdb.dialog.delete',
            [
                'category' => $category,
                'property' => $attribute,
                'entry_id' => $entryID
            ]
        );

        return $this;
    }
295899
public function deleteGroup($groupId)
    {
        $objectStates = $this->loadObjectStates($groupId);
        foreach ($objectStates as $objectState) {
            $this->objectStateGateway->deleteObjectStateLinks($objectState->id);
            $this->objectStateGateway->deleteObjectState($objectState->id);
        }

        $this->objectStateGateway->deleteObjectStateGroup($groupId);
    }
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);
            }
        }

    }
566891
public void deleteCategory(final CmsUUID id) {

        CmsDeleteWarningDialog deleteWarningDialog = new CmsDeleteWarningDialog(id) {

            @Override
            protected void onAfterDeletion() {

                CmsSitemapView.getInstance().getController().loadCategories(true, null);
            }
        };
        deleteWarningDialog.loadAndShow(null);
    }
1316150
public function createCategoryRelation($categoryId)
    {
        //niepoprawna kategoria
        if (null === $categoryRecord = (new CmsCategoryQuery)
            ->findPk($categoryId)) {
            return;
        }
        //wyszukiwanie relacji
        $relationRecord = (new CmsCategoryRelationQuery)
            ->whereCmsCategoryId()->equals($categoryRecord->id)
            ->andFieldObject()->equals($this->_object)
            ->andFieldObjectId()->equals($this->_objectId)
            ->findFirst();
        //znaleziona relacja - nic do zrobienia
        if (null !== $relationRecord) {
            return;
        }
        //tworzenie relacji
        $newRelationRecord = new CmsCategoryRelationRecord;
        $newRelationRecord->cmsCategoryId = $categoryRecord->id;
        $newRelationRecord->object = $this->_object;
        $newRelationRecord->objectId = $this->_objectId;
        //zapis
        $newRelationRecord->save();
    }
585301
public function deleteCategory(Category $category)
    {
        $forum = $category->getForum();

        if ($this->authorization->isGranted('moderate', new ResourceCollection(array($category->getForum()->getResourceNode())))) {

            $this->manager->deleteCategory($category);

            return new RedirectResponse(
                $this->generateUrl('claro_forum_categories', array('forum' => $forum->getId()))
            );
        }

        throw new AccessDeniedException();
    }
1353118
public function isUserAllowedNewsCategory($categoryId)
    {
        if (null === ($roots = $this->getUserAllowedRoots())) {
            return true;
        }

        /** @var Database $db */
        $db = $this->framework->createInstance(Database::class);

        $ids = $db->getChildRecords($roots, 'tl_news_category', false, $roots);
        $ids = \array_map('intval', $ids);

        return \in_array((int) $categoryId, $ids, true);
    }
233105
public function removeChild(\Amulen\ClassificationBundle\Entity\Category $children)
    {
        $this->children->removeElement($children);
    }
810617
protected function load_category($categoryid) {
        global $DB;
        $category = $DB->get_record('course_categories', array('id' => $categoryid));
        if (!$category) {
            throw new moodle_exception('unknowncategory');
        }
        $this->_categories[$category->id] = $category;
        $parentcategoryids = explode('/', trim($category->path, '/'));
        array_pop($parentcategoryids);
        foreach (array_reverse($parentcategoryids) as $catid) {
            $this->_categories[$catid] = null;
        }
    }