You are here

public function DBObject::delete in Entity Construction Kit (ECK) 7.2

Same name and namespace in other branches
  1. 7.3 eck.classes.inc \DBObject::delete()

Delete.

2 calls to DBObject::delete()
Bundle::delete in ./eck.classes.inc
Delete the entity type.
EntityType::delete in ./eck.classes.inc
Delete.
2 methods override DBObject::delete()
Bundle::delete in ./eck.classes.inc
Delete the entity type.
EntityType::delete in ./eck.classes.inc
Delete.

File

./eck.classes.inc, line 152
Classes for all the different objects used in ECK.

Class

DBObject
@file Classes for all the different objects used in ECK.

Code

public function delete() {

  // We can only deleted if its a loaded object, or if it has been saved.
  if (!$this->isNew) {
    $query = db_delete($this->table);
    $primary_key = $this->primaryKeys[0];
    $query
      ->condition($primary_key, $this->{$primary_key}, '=');
    $query
      ->execute();

    // Should we delete the data from the object.. not sure.
    // For right now lets just set it back to new.
    $this->isNew = TRUE;
  }
}