destroy($value)
Delete data from database

@return bool
324897
public function destroy($value, $dbConnection = NULL)
    {
        $connection = DatabaseQuery::checkConnection($dbConnection);

        $query = $connection->prepare('DELETE FROM ' . self::getTableName($connection) . ' WHERE id = '.$value);
        $query->execute();
        $check = $query->rowCount();
        if ($check) {
            return true;
        }
        throw new DataNotFoundException;
    }
1106707
public function delete()
    {
        $sql = 'delete from `' . $this->table . '`';

        if (!is_null($this->where)) {
            $sql .= ' where ' . $this->where;

            $this->where = null;
        }

        $stmt = $this->connection->prepare($sql);

        $this->bind($stmt, $this->where_data_binding);

        $this->where_data_binding = [];

        $stmt->execute();

        $r = $stmt->rowCount();

        return (int) $r;
    }
569072
public function delete()
    {
        if ($this->getPk() === null) {
            return false;
        }
        $query = $this->_queryClass;
        $bindKey = PdoBindHelper::generateBindKey();
        $result = DbConnector::getAdapter()->delete((new $query)->getTableName(), $this->_pkWhere($bindKey), [$bindKey => $this->getInitialStateValue('id')]);
        return ($result > 0) ? true : false;
    }
537228
public function delete(): bool
    {
        /**
         * Execute pre-DELETE logic
         */
        $this->beforeDelete();

        $primaryKey = $this->getPrimaryKey();

        /**
         * Execute the DELETE (this may throw an exception)
         */
        $table = $this->getTable();
        $result = $table::delete($primaryKey);

        /**
         * Execute post-DELETE logic
         */
        $this->afterDelete();

        /**
         * Reset all fields to null to indicate that the row is not there
         */
        $this->resetArray();

        return $result > 0;
    }
1269130
public function destroy(): bool
    {
        if (! $this->isStarted()) {
            $this->start();
        }
        $name = $this->getName();
        $params = $this->getCookieParams();
        $this->clear();
        $destroyed = session_destroy();
        if ($destroyed) {
            call_user_func($this->delete_cookie, $name, $params);
        }

        return $destroyed;
    }
673818
public function delete()
    {
        $affected = 0;
        foreach ($this->table->data['data'] as $rs) {
            if ($this->matchWhere($rs)) {
                unset($this->table->data['data'][$rs['id']]);
                $affected++;
            }
        }

        if ($affected) {
            $this->table->save();
        }

        return $affected;
    }
614282
public function delete($value)
    {
        $id = is_object($value) ? spl_object_hash($value) : $value;
        unset($this->_keys[$id]);
        unset($this->_data[$id]);
        return $this;
    }
203162
public function clear()
    {
        try {
            $this->db->from($this->table)->delete();
        } catch (PDOException $e) {
            return false;
        }

        return true;
    }
781617
public static function destroy($id)
    {
        $table = self::getTableNameFromClass();

        self::getOne($id);

        $query = "DELETE FROM $table WHERE id = ".$id;

        try {
            Connection::db()->query($query);
            return true;
        } catch (Exception $e) {
            return false;
        }
    }
33618
public function destroy()
	{
		$data = $this->toArray();

		// Trigger the onUserBeforeDelete event
		Event::trigger('user.onUserBeforeDelete', array($data));

		// Remove associated data
		if ($this->reputation->get('id'))
		{
			if (!$this->reputation->destroy())
			{
				$this->addError($this->reputation->getError());
				return false;
			}
		}

		foreach ($this->tokens()->rows() as $token)
		{
			if (!$token->destroy())
			{
				$this->addError($token->getError());
				return false;
			}
		}

		Map::destroyByUser($this->get('id'));

		// Attempt to delete the record
		$result = parent::destroy();

		if ($result)
		{
			// Trigger the onUserAfterDelete event
			Event::trigger('user.onUserAfterDelete', array($data, true, $this->getError()));
		}

		return $result;
	}
608273
public function deleteByValue($value, bool $strict = true) : void
    {
        foreach($this->_data as $data) {
            $exists = ($strict) ? ($data === $value)
                                : ($data == $value);

            if($exists) {
                unset($this->_data[$value]);
            }
        }
    }
511932
public function destroy()
	{
		// If it has an associated asset entry, try deleting that first
		if ($this->hasAttribute('asset_id'))
		{
			if (!Asset::destroy($this))
			{
				return false;
			}
		}

		\Event::trigger('system.onContentDestroy', array($this->getTableName(), $this));
		return $this->query->remove(
			$this->getTableName(),
			$this->getPrimaryKey(),
			$this->getPkValue()
		);
	}
850677
public function endsWith($value): bool
    {
        if ($this->count() <= 0) {
            return false;
        }

        $lastValue = $this->list[$this->count() - 1];

        return ($lastValue == $value);
    }
703698
public function destroy()
    {
        $keys = [];

        foreach ($this->rows as $key => $row) {
            if ($this->rowStateIsNew($key)) {
                continue;
            }

            $keys[] = $this->rowFirstUnique($row);

            $this->markRowAsNew($key);
        }

        if ($keys) {
            [$sql, $params] = $this->newDeleteQuery()->where($this->firstUniqueKey(), $keys)->toSql();

            $this->connection()->sqlExecute($sql, $params);
        }

        return $this;
    }
207434
public function destroy()
	{
		// Can't delete what doesn't exist
		if ($this->isNew())
		{
			return true;
		}

		// Remove comments
		foreach ($this->replies()->rows() as $comment)
		{
			if (!$comment->destroy())
			{
				$this->addError($comment->getError());
				return false;
			}
		}

		// Remove votes
		foreach ($this->votes()->rows() as $vote)
		{
			if (!$vote->destroy())
			{
				$this->addError($vote->getError());
				return false;
			}
		}

		// Remove files
		foreach ($this->files()->rows() as $file)
		{
			if (!$file->destroy())
			{
				$this->addError($file->getError());
				return false;
			}
		}

		return parent::destroy();
	}
723139
public function delete() {
        global $DB;

        if (empty($this->id)) {
            debugging('Can not delete data object, no id!');
            return false;
        }

        $data = $this->get_record_data();

        if ($DB->delete_records($this->table, array('id'=>$this->id))) {
            $this->notify_changed(true);
            return true;

        } else {
            return false;
        }
    }
905959
public function remove($value)
    {
        if (is_array($value)) {
            return $this->handleArray('remove', $value);
        }
        $key = array_search($value, $this->values);
        if (false === $key) {
            return false;
        }
        $this->offsetUnset($key);
        return true;
    }