src/Web2All/Table/SaveObjectTrait.php
public function deleteFromDB()
  {
    // first check if keys are available
    if (!$this->isValid()) {
      return false;
    }
    
    if(count($this->key_properties)==0){
      // cannot delete without keys
      return false;
    }
    // build where part
    $where_part='';
    foreach ($this->key_properties as $key) {
      if ($where_part) {
        $where_part.=' AND ';
      }
      if ($this->{$key} instanceof Web2All_Table_SQLOperation) {
        trigger_error('Web2All_Table_SaveObjectTrait->deleteFromDB(): using Web2All_Table_SQLOperation object for key value '.$key,E_USER_NOTICE);
        $where_part.=$this->obj_to_db_trans[$key].'='.$this->{$key}->toSQLString();

      }else if ($this->{$key} instanceof Web2All_Table_SQLOperationList) {
        throw new Exception("Web2All_Table_SaveObjectTrait: can't delete using a Web2All_Table_SQLOperationList for key value ".$key);
        
      }else{
        $where_part.=$this->obj_to_db_trans[$key].'='.$this->db->Quote($this->{$key});
      }
    }
    
    $this->db->Execute('DELETE FROM '.$this->quote($this->tablename).' WHERE '.$where_part.' ');
    
    return true;
  }
public function deleteFromDB()
  {
    // first check if keys are available
    if (!$this->isValid()) {
      return false;
    }
    
    if(count($this->key_properties)==0){
      // cannot delete without keys
      return false;
    }
    // build where part
    $where_part='';
    foreach ($this->key_properties as $key) {
      if ($where_part) {
        $where_part.=' AND ';
      }
      if ($this->{$key} instanceof Web2All_Table_SQLOperation) {
        trigger_error('Web2All_Table_SaveObjectTrait->deleteFromDB(): using Web2All_Table_SQLOperation object for key value '.$key,E_USER_NOTICE);
        $where_part.=$this->obj_to_db_trans[$key].'='.$this->{$key}->toSQLString();

      }else if ($this->{$key} instanceof Web2All_Table_SQLOperationList) {
        throw new Exception("Web2All_Table_SaveObjectTrait: can't delete using a Web2All_Table_SQLOperationList for key value ".$key);
        
      }else{
        $where_part.=$this->obj_to_db_trans[$key].'='.$this->db->Quote($this->{$key});
      }
    }
    
    $this->db->Execute('DELETE FROM '.$this->quote($this->tablename).' WHERE '.$where_part.' ');
    
    return true;
  }
Delete the current object from the database.

It is required that all key properties are set.

@return boolean