Destroy this entity on the server if it was already persisted. Optimistically removes the entity from its collection, if it has one. If `wait: true` is passed, waits for the server to respond before removal.
346013
function(options) {
      options = options ? langx.clone(options) : {};
      var entity = this;
      var success = options.success;
      var wait = options.wait;

      var destroy = function() {
        entity.stopListening();
        entity.trigger('destroy', entity, entity.collection, options);
      };

      options.success = function(resp) {
        if (wait) destroy();
        if (success) success.call(options.context, entity, resp, options);
        if (!entity.isNew()) entity.trigger('sync', entity, resp, options);
      };

      var xhr = false;
      if (this.isNew()) {
        langx.defer(options.success);
      } else {
        wrapError(this, options);
        xhr = this.sync('delete', this, options);
      }
      if (!wait) destroy();
      return xhr;
    }
839356
public void remove(Object e)
    {
        // Invoke Pre Remove Events

        // TODO Check for validity also as per JPA
        if (e == null)
        {
            throw new IllegalArgumentException("Entity to be removed must not be null.");
        }

        EntityMetadata metadata = getMetadata(e.getClass());

        // Create an object graph of the entity object
        ObjectGraph graph = new GraphGenerator().generateGraph(e, this, new ManagedState());

        Node node = graph.getHeadNode();

        try
        {
            lock.writeLock().lock();

            // TODO : push into action queue, get original end-point from
            // persistenceContext first!

            // Action/ExecutionQueue/ActivityQueue :-> id, name, EndPoint,
            // changed
            // state

            // Change state of node, after successful flush processing.
            node.setPersistenceDelegator(this);
            node.remove();

            // build flush stack.

            flushManager.buildFlushStack(node, EventType.DELETE);

            // Flush node.
            flush();
        }
        finally
        {
            lock.writeLock().unlock();
        }
        // clear out graph
        graph.clear();
        graph = null;

        if (log.isDebugEnabled())
        {
            log.debug("Data removed successfully for entity : " + e.getClass());
        }
    }
397540
def destroy(self, request, *args, **kwargs):
        
        obj = self.get_object()
        user = request.user

        if strtobool(request.query_params.get('delete_content', 'false')):
            for entity in obj.entity_set.all():
                if user.has_perm('edit_entity', entity):
                    entity.delete()

            for data in obj.data.all():
                if user.has_perm('edit_data', data):
                    data.delete()

        return super().destroy(request, *args, **kwargs)
1110969
def destroy(options={}, &block)
      object = resource
      options[:location] ||= smart_collection_url

      destroy_resource(object)
      respond_with_dual_blocks(object, options, &block)
    end
898249
def remove(self, value, session=None):
        ''''''
        s, instance = self.session_instance('remove', value, session)
        # update state so that the instance does look persistent
        instance.get_state(iid=instance.pkvalue(), action='update')
        return s.delete(instance)
793921
def destroy(self):
        
        self._on_destroy()
        return self._client.proxy.destroy_proxy(self.service_name, self.name)
386165
def delete(self):
        
        # Fetch Model class and connected repository from Repository Factory
        model_cls = repo_factory.get_model(self.__class__)
        repository = repo_factory.get_repository(self.__class__)

        try:
            if not self.state_.is_destroyed:
                # Update entity's data attributes
                repository.delete(model_cls.from_entity(self))

                # Set Entity status to saved
                self.state_.mark_destroyed()

            return self
        except Exception:
            # FIXME Log Exception
            raise
620900
public void destroy() {
        DeferredBindingActions.clear();
        if(!disconnected.isEmpty()) {
            disconnected.pop();
        }
        if (getSessionFactory() == null || decNestingCount() > 0 || getParticipate()) {
            return;
        }

        // single session mode
        SessionHolder holder = (SessionHolder) TransactionSynchronizationManager.unbindResource(getSessionFactory());
        LOG.debug("Closing single Hibernate session in GrailsDispatcherServlet");
        try {
            disconnected.clear();
            SessionFactoryUtils.closeSession(holder.getSession());
        }
        catch (RuntimeException ex) {
            LOG.error("Unexpected exception on closing Hibernate Session", ex);
        }
    }
183153
protected <T> void remove(Class<T> entityClass, Object id)
    {
        remove(entityClass, id, Boolean.TRUE);
    }
368855
async def destroy_tournament(self, t: Tournament):
        
        await self.connection('DELETE', 'tournaments/{}'.format(t.id))
        if t in self.tournaments:
            self.tournaments.remove(t)
190101
def destroy(self, force=False):
        
        if force:
            super(UnmanagedLXC, self).destroy()
        else:
            raise UnmanagedLXCError('Destroying an unmanaged LXC might not '
                'work. To continue please call this method with force=True')
685956
def destroy(options = {:hard => false})
      if options[:hard]
        with_transaction_returning_status do
          hard_destroy_associated_records
          self.reload.hard_destroy
        end
      else
        return true if destroyed?
        with_transaction_returning_status do
          destroy_at = Time.now
          run_callbacks(:destroy){ update_column kakurenbo_column, destroy_at; self }
        end
      end
    end
508080
@Override
    public void destroy() // PK20881
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "destroy");

        // Dummy transactionWrappers may not be in any table and so
        // will not have a resourceCallback registered to remove them.
        if (_resourceCallback != null)
            _resourceCallback.destroy();

        _wrappers.remove(_transaction.getGlobalId());

        //      Do not remove connection with the TransactionImpl.  This will delay garbage
//      collection until the TransactionWrapper is garbage collected.
//      There is a window when an incoming request can access the remoteable object
//      (ie WSCoordinator or CoordinatorResource) and get access to the TransactionWrapper
//      while destroy() is called by another thread as the synchronization is on the
//      TransactionWrapper.  When the incoming request gets control, it will find that
//      _transaction is null.  Rather than check for this case, we leave the connection
//      to the TransactionImpl and its associated TransactionState.  The code above will
//      then check the transaction state and respond appropriately.  These checks are
//      already required as the superior may retry requests, etc.
//        _transaction = null;

        if (tc.isEntryEnabled())
            Tr.exit(tc, "destroy");
    }
555664
public void destroySelf(){
        if(mPager == null || mPager.getAdapter() == null){
            return;
        }
        InfinitePagerAdapter wrapper = (InfinitePagerAdapter)mPager.getAdapter();
        PagerAdapter adapter = wrapper.getRealAdapter();
        if(adapter!=null){
            adapter.unregisterDataSetObserver(dataChangeObserver);
        }
        removeAllViews();
    }
484201
def delete(self):
        

        if not self.object_id:
            return False

        url = self.build_url(
            self._endpoints.get('item').format(id=self.object_id))

        response = self.con.delete(url)
        if not response:
            return False

        self.object_id = None

        return True
968801
def destroy
      run_callbacks(:before_destroy)
      new_data = self.class.all.reject { |item| item.persisted_attributes == self.persisted_attributes }.map { |item| item.persisted_attributes }
      self.class.write_contents(new_data)
      self.is_destroyed = true
      run_callbacks(:after_destroy)
      true
    rescue IOError
      false
    end
231784
def delete(self):
        
        try:
            if self.exists() is False:
                return None
            self.db.session.delete(self)
            self.db.session.commit()
        except (Exception, BaseException) as error:
            # fail silently
            return None