Delete all database tables related to the field
@param int $field_id
509908
protected function deleteLinked($field_id)
    {
        $this->db->delete('field_value', array('field_id' => $field_id));
        $this->db->delete('field_translation', array('field_id' => $field_id));
        $this->db->delete('product_class_field', array('field_id' => $field_id));
    }
764948
public function delete($table_name, $id) {
            Event::dispatch(EventData::forBefore(Event::BEFORE_DELETE, $table_name, ['id' => $id]));
            $q = $this->config->getSystemIdentifierQuote();

            if (!$id || !$table_name) {
                return false;
            }

            $sql_query = 'DELETE FROM ' . $q . $table_name . $q . ' WHERE ' . $q . 'id' . $q . ' = :delete_id';
            try {
                //Run update query, collect stats
                $stmt = $this->db_connection->prepare($sql_query);
                $stmt->bindValue(':delete_id', $id);
                $stmt->execute();
            } catch (Exception $ex) {
                Event::dispatch(EventData::forException($ex, $sql_query, [':delete_id' => $id]));
                throw new QueryException($ex->getMessage(), $ex->getCode(), $ex);
            }
            $rows_affected = $stmt->rowCount();
            Event::dispatch(EventData::forAfter(Event::AFTER_DELETE, $table_name, [':delete_id' => $id], $sql_query, $rows_affected));

            return $rows_affected;
        }
877180
public static function removeMemorizedValue($fieldId = null)
    {
        if (isset($_SESSION['_FIELDS'])) {
            if (is_null($fieldId)) {
                $_SESSION['_FIELDS'] = null;
                unset($_SESSION['_FIELDS']);
            } else {
                unset($_SESSION['_FIELDS'][$fieldId]);
            }
        }
    }
94495
public function deleteField($fieldname) {

        $field = $this->getField($fieldname);
        if ($field) {
            $i = $this->findFieldInArray($fieldname);
            // Look for prev and next field
            $prevfield = $this->getField($field->getPrevious());
            $nextfield = $this->getField($field->getNext());
            // Change their previous and next attributes
            if ($prevfield) {
                $prevfield->setNext($field->getNext());
            }
            if ($nextfield) {
                $nextfield->setPrevious($field->getPrevious());
            }
            // Delete the field
            unset($this->fields[$i]);
            // Reorder the whole structure
            $this->orderFields($this->fields);
            // Recalculate the hash
            $this->calculateHash(true);
            // We have one deleted field, so the table has changed
            $this->setChanged(true);
        }
    }
174054
public function removeTerm($term_id) {
    $term_id = ($term_id instanceof Term) ? $term_id->id : $term_id;
    return $this->related()->where('term_id', $term_id)->delete();
  }
20512
public function update($field_id, array $data)
    {
        $result = null;
        $this->hook->attach('field.update.before', $field_id, $data, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        unset($data['type']);

        $updated = $this->db->update('field', $data, array('field_id' => $field_id));
        $data['field_id'] = $field_id;
        $updated += (int) $this->setTranslations($data, $this->translation_entity, 'field');

        $result = $updated > 0;
        $this->hook->attach('field.update.after', $field_id, $data, $result, $this);
        return (bool) $result;
    }
493121
public function deleteFields(array $fields)
    {
        $fields = Validate::arrToLower($fields);
        if (($key = array_search($this->databaseConfig->getIdentifier(), $fields)) !== false)
            throw new \Exception('You can not delete the id field');
        $diff   = array_diff($fields,$this->fields());
        if (!empty($diff))
            throw new \Exception('Field(s) "' . implode(', ', $diff) . '" does not exists in table');
        $config         = $this->getConfig();
        $config->schema = array_diff_key($this->schema(), array_flip($fields));
        $data = $this->getData();
        foreach ($data as $key => $object)
        {
            foreach ($fields as $name)
                unset($data[$key]->{$name});
        }
        $this->databaseDocument->put($data);
        $this->databaseConfig->put($config);
        return true;
    }
1266185
public function delete($order_id)
    {
        $result = null;
        $this->hook->attach('order.delete.before', $order_id, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $result = (bool) $this->db->delete('orders', array('order_id' => $order_id));

        if ($result) {
            $this->deleteLinked($order_id);
        }

        $this->hook->attach('order.delete.after', $order_id, $result, $this);
        return (bool) $result;
    }
450783
public function deleteAll()
    {
        $schema = $this->getConn()->getSchemaManager();
        foreach ($schema->databaseList() as $dbName) {
            if ($this->isDBTemp($dbName)) {
                $schema->dropDatabase($dbName);
                $schema->alterationMessage("Dropped database \"$dbName\"", 'deleted');
                flush();
            }
        }
    }
529299
private void doDelete(DBIDRef id) {
    // Remove id
    ids.remove(id);
    // Remove from all representations.
    for(Relation<?> relation : relations) {
      // ID has already been removed, and this would loop...
      if(relation == idrep) {
        continue;
      }
      if(!(relation instanceof ModifiableRelation)) {
        throw new AbortException("Non-modifiable relations have been added to the database.");
      }
      ((ModifiableRelation<?>) relation).delete(id);
    }
    DBIDFactory.FACTORY.deallocateSingleDBID(id);
  }
619573
protected function canDelete($field_value_id)
    {
        $sql = 'SELECT c.product_id
                FROM product_field pf
                LEFT JOIN cart c ON(pf.product_id = c.product_id)
                WHERE pf.field_value_id=?';

        $result = $this->db->fetchColumn($sql, array($field_value_id));
        return empty($result);
    }
1126315
protected function deleteLinked($category_id)
    {
        $this->db->delete('category_translation', array('category_id' => $category_id));
        $this->db->delete('file', array('entity' => 'category', 'entity_id' => $category_id));
        $this->db->delete('alias', array('entity' => 'category', 'entity_id' => $category_id));
    }
1202471
public function destroy($id)
    {
        try {
            return (bool) $this->db->from($this->table)
                    ->where($this->columns['id'])->eq($id)
                    ->delete();
        } catch (PDOException $e) {
            return false;
        }
    }
996620
protected function setFieldFieldValue($field_id)
    {
        $this->data_field = $this->field->get($field_id);

        if (empty($this->data_field)) {
            $this->outputHttpStatus(404);
        }
    }
209227
public function editField($field_id = null)
    {
        $this->setField($field_id);
        $this->setTitleEditField();
        $this->setBreadcrumbEditField();

        $this->setData('field', $this->data_field);
        $this->setData('types', $this->field->getTypes());
        $this->setData('can_delete', $this->canDeleteField());
        $this->setData('widget_types', $this->field->getWidgetTypes());
        $this->setData('languages', $this->language->getList(array('enabled' => true)));

        $this->submitEditField();
        $this->outputEditField();
    }
1136978
public static function delete($topic_id)
    {
        // Delete the topic and any redirect topics
        $where_delete_topic = [
            ['id' => $topic_id],
            ['moved_to' => $topic_id]
        ];

        DB::forTable('topics')
            ->where_any_is($where_delete_topic)
            ->delete_many();

        // Delete posts in topic
        DB::forTable('posts')
            ->where('topic_id', $topic_id)
            ->delete_many();

        // Delete any subscriptions for this topic
        DB::forTable('topic_subscriptions')
            ->where('topic_id', $topic_id)
            ->delete_many();
    }
1208941
public function delete($fieldsValues)
    {
        $this->connectToDB();
        $this->queryBuilder->table($this->table());
        $this->queryBuilder->delete($fieldsValues);
    }