This function destroyes a category.
769003
def destroy
      @category = LatoBlog::Category.find_by(id: params[:id])
      return unless check_category_presence

      if !@category.destroy
        flash[:danger] = @category.category_parent.errors.full_messages.to_sentence
        redirect_to lato_blog.edit_category_path(@category.id)
        return
      end
      
      flash[:success] = LANGUAGES[:lato_blog][:flashes][:category_destroy_success]
      redirect_to lato_blog.categories_path(status: 'deleted')
    end
1009563
function destroy () {
    if (this.connection.destroy) {
      this.connection.destroy()
    } else if (this.connected) {
      this.connection.disconnect('destroy')
    }
    for (var i = 0; i < this.unbind.length; i++) {
      this.unbind[i]()
    }
    clearTimeout(this.pingTimeout)
    this.endTimeout()
  }
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();
   }
101333
public void uncheckCategories(List<String> categories) {

        for (String category : categories) {
            CmsTreeItem item = searchTreeItem(m_scrollList, category);
            item.getCheckBox().setChecked(false);
        }
    }
1059933
def reset_category(self, category, metric_slugs):
        
        key = self._category_key(category)
        if len(metric_slugs) == 0:
            # If there are no metrics, just remove the category
            self.delete_category(category)
        else:
            # Save all the slugs in the category, and save the category name
            self.r.sadd(key, *metric_slugs)
            self.r.sadd(self._categories_key, category)
1310517
function destroy() {
         me.pool.push(this.color);
         this.color = undefined;

         this._super(me.Renderable, "destroy");
       }
1205998
function destroy(obj) {
    for (var i in obj) {
        if (obj.hasOwnProperty(i) && obj[i]) {
            if ($.isArray(obj[i])) {
                obj[i].length = 0;
            }
            if ($.isFunction(obj[i].destroy)) {
                obj[i].destroy();
            }
            delete obj[i];
        }
    }
}
1298638
public void destroy() {

        m_attributeName = null;
        m_attributeType = null;
        m_attributeValueViews.clear();
        m_attributeValueViews = null;
        m_dndHandler = null;
        m_entity = null;
        m_entityType = null;
        m_entityBackEnd = null;
        m_widgetService = null;
    }
884888
@Override
    public void remove(TypeCategory typeCategory, String typeName)
            throws AtlasException {

        assertValidTypeCategory(typeCategory);
        remove(typeName);
    }
719789
protected function deleteCategoryGroup()
    {
        $this->controlAccess('category_group_delete');

        if ($this->category_group->delete($this->data_category_group['category_group_id'])) {
            $this->redirect('admin/content/category-group', $this->text('Category group has been deleted'), 'success');
        }

        $this->redirect('', $this->text('Category group has not been deleted'), 'warning');
    }
677661
public function destroy()
    {
        // Delete from the persistence layer.
        $this->getDataSource()->destroy($this->id);
        // Remove from the registry.
        $this->getFactory()->unregisterEntity($this);
        // Done, garbage collection should do the rest.
    }
1098070
public function destroy()
    {
        $this->identifierMap = [];
        $this->objectMap = new \SplObjectStorage();
        $this->reconstitutedEntities = new \SplObjectStorage();
        $this->reconstitutedEntitiesData = [];
    }
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);
            }
        }

    }
701931
final public function destroy()
    {
        foreach ($this->registry as $offset => $object) {
            if (method_exists($object, '__destruct')) {
                $object->__destruct();
            }
            unset($this->registry[ $offset ]);
        }
    }
241992
public function removeCategory(CategoryInterface $category)
    {
        if ($this->hasCategory($category)) {
            $this->categories->removeElement($category);
        }

        return $this;
    }
1131483
function destroy(req, res, next) {
  db.posts.del(req.params.post, function(err) {
    if(err) { return next(err); }
    res.json(null);
    signals.emit('post:destroy', req.params.post);
  });
}
984418
function() {
        if(this.features) {
            for(var i=0; i<this.features.length; ++i) {
                this.features[i].destroy();
            }
        }
        this.features = null;
        this.num = null;
    }