You are here

public function EntityDrupalWrapper::delete in Entity API 7

Permanently delete the wrapped entity.

Return value

EntityDrupalWrapper

File

includes/entity.wrapper.inc, line 907
Provides wrappers allowing easy usage of the entity metadata.

Class

EntityDrupalWrapper
Provides a wrapper for entities registrered in hook_entity_info().

Code

public function delete() {
  if ($this
    ->dataAvailable() && $this
    ->value()) {
    $return = entity_delete($this->type, $this->id);
    if ($return === FALSE) {
      throw new EntityMetadataWrapperException("There is no information about how to delete entities of type " . check_plain($this->type) . '.');
    }
  }
  return $this;
}