Delete model

@param model model instance
@param <S>
@return affect the number of rows
545079
public <S extends Model> int deleteByModel(S model) {
        this.beforeCheck();
        String       sql             = this.buildDeleteSQL(model);
        List<Object> columnValueList = AnimaUtils.toColumnValues(model, false);
        return this.execute(sql, columnValueList);
    }
739882
public function delete($model)
    {
        $this->cache->flush();
        $this->cache->flush('dashboard');

        return $this->repo->delete($model);
    }
1263152
public static <S extends Model> Object getAndRemovePrimaryKey(S model) {
        String fieldName = getPKField(model.getClass());
        Object value     = invokeMethod(model, getGetterName(fieldName), EMPTY_ARG);
        if (null != value) {
            invokeMethod(model, getSetterName(fieldName), NULL_ARG);
        }
        return value;
    }
1038950
def delete(self, model):
        

        signals.pre_delete.send(model.__class__, model=model)

        param = {'rid_value': self.to_pg(model)[model.rid_field]}
        query = """
                DELETE FROM {table}
                WHERE {rid_field} = %(rid_value)s
                RETURNING {cols};
                """

        query = query.format(
            cols=self.field_cols(model),
            rid_field=model.rid_field,
            table=model.rtype,
        )

        result = self.query(query, param=param)

        signals.post_delete.send(model.__class__, model=model)

        return result
735999
def delete_model(self, model):
        """"""
        if SessionActivity.is_current(sid_s=model.sid_s):
            flash('You could not remove your current session', 'error')
            return
        delete_session(sid_s=model.sid_s)
        db.session.commit()
1240908
function( model ) {
			model.unbind( 'destroy', this.unregister );
			var coll = this.getCollection( model );
			coll && coll.remove( model );
		}
141048
public void removeFilterModel(final FilterModel model) {
		if (model.getUrlPatterns() != null) {
			try {
				deassociateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
				filterLock.writeLock().lock();
				for (String virtualHost:resolveVirtualHosts(model)) {
					for (String urlPattern : model.getUrlPatterns()) {
							String fullPath = getFullPath(model.getContextModel(), urlPattern);
							Set<UrlPattern> urlSet = filterUrlPatterns.get(virtualHost).get(fullPath);
							UrlPattern toDelete = null;
							for (UrlPattern pattern : urlSet) {
									FilterModel filterModel = (FilterModel) pattern.getModel();
									Class<?> filter = filterModel.getFilterClass();
									Class<?> matchFilter = model.getFilterClass();
									if (filter != null && filter.equals(matchFilter)) {
											toDelete = pattern;
											break;
									}
							}
							urlSet.remove(toDelete);
					}
				}
			} finally {
				filterLock.writeLock().unlock();
			}
		}
	}
1176716
function(models, options) {
      var removed = [];
      for (var i = 0; i < models.length; i++) {
        var model = this.get(models[i]);
        if (!model) continue;

        var index = this.indexOf(model);
        this.models.splice(index, 1);
        this.length--;

        // Remove references before triggering 'remove' event to prevent an
        // infinite loop. #3693
        delete this._byId[model.cid];
        var id = this.modelId(model.attributes);
        if (id != null) delete this._byId[id];

        if (!options.silent) {
          options.index = index;
          model.trigger('remove', model, this, options);
        }

        removed.push(model);
        this._removeReference(model, options);
      }
      return removed;
    }
480985
public function delete($model)
    {
        $this->callBeforeListeners('destroy', [$model]);
        $this->model()->remove($model);
        $this->callAfterListeners('destroy', [$model]);
        return $model;
    }
1257981
protected boolean deleteModel(MODEL_ID id, boolean permanent) throws Exception {
        if (permanent) {
            server.deletePermanent(modelType, id);
        } else {
            server.delete(modelType, id);
        }
        return permanent;
    }
761928
@RequestMapping(value = "api/group/{groupId}", method = RequestMethod.DELETE)
    public
    @ResponseBody
    List<Group> removeGroup(Model model,
                                 @PathVariable int groupId) {
        pathOverrideService.removeGroup(groupId);
        return pathOverrideService.findAllGroups();
    }
112538
public function deleting($model)
    {
        foreach ($this->relations as $relation) {
            if ($model->{$relation}()->count() > 0) {
                // Returning false from an Eloquent event listener will cancel the operation.
                return false;
            }
        }
    }
627720
public function deleteModel($model)
    {
        // first remove any automatically created models
        /** @var $relationField ManyToManyField */
        foreach ($model->getMeta()->localManyToMany as $name => $relationField) {
            if ($relationField->relation->through->getMeta()->autoCreated) {
                $this->deleteModel($relationField->relation->through);
            }
        }
        $this->dropTable($model->getMeta()->getDbTable());
    }
1192853
public function delete ($Model)
    {
        $entity   = $Model->getEntity();
        $entityId = $entity->getId();

        // Clear cache first
        if (isset($this->cache[$entityId])) {
            unset($this->cache[$entityId]);
        }

        $this->em->remove($entity);
        $this->em->flush();
    }
1152035
def delete_model(self, model):
        """"""
        try:
            if model.json is None:
                return True
            record = Record(model.json, model=model)
            record.delete()
            db.session.commit()
        except SQLAlchemyError as e:
            if not self.handle_view_exception(e):
                flash(_('Failed to delete record. %(error)s', error=str(e)),
                      category='error')
            db.session.rollback()
            return False
        return True
1085394
public function delete(AbstractModel $model)
    {

        list($query, $param, $type) = $this->queryBuilder->generateDeleteForModel($model);

        if ($this->modelCache->get($model)) {
            $this->modelCache->remove($model);
        }
        
        $stmt = $this->prepare($query, $param);

        if ($stmt->execute()) {
            return true;

        } else {
            $this->log(ILog::T_ERROR, print_r($stmt->errorInfo(), true));
            return false;
        }
    }
610769
function (model, options) {
        if (this === model.collection) delete model.collection;
        this._deIndex(model);
        if (model.off) model.off('all', this._onModelEvent, this);
    }