public function delete($id = null)
    {
        if (!is_null($id)) {
            $this->load($id);
        }
        if (!$this->loaded()) {
            throw $this->exception('Unable to determine which record to delete');
        }

        $tmp = $this->dsql;

        $this->initQuery();
        $delete = $this->dsql->where($this->id_field, $this->id);

        $delete->owner->beginTransaction();
        $this->hook('beforeDelete', array($delete));
        $delete->delete();
        $this->hook('afterDelete');
        $delete->owner->commit();

        $this->dsql = $tmp;
        $this->unload();

        return $this;
    }
public function delete($id = null)
    {
        if (!is_null($id)) {
            $this->load($id);
        }
        if (!$this->loaded()) {
            throw $this->exception('Unable to determine which record to delete');
        }

        $tmp = $this->dsql;

        $this->initQuery();
        $delete = $this->dsql->where($this->id_field, $this->id);

        $delete->owner->beginTransaction();
        $this->hook('beforeDelete', array($delete));
        $delete->delete();
        $this->hook('afterDelete');
        $delete->owner->commit();

        $this->dsql = $tmp;
        $this->unload();

        return $this;
    }
public function delete ( $ id = null ) { if ( ! is_null ( $ id ) ) { $ this -> load ( $ id ) ; } if ( ! $ this -> loaded ( ) ) { throw $ this -> exception ( 'Unable to determine which record to delete' ) ; } $ tmp = $ this -> dsql ; $ this -> initQuery ( ) ; $ delete = $ this -> dsql -> where ( $ this -> id_field , $ this -> id ) ; $ delete -> owner -> beginTransaction ( ) ; $ this -> hook ( 'beforeDelete' , array ( $ delete ) ) ; $ delete -> delete ( ) ; $ this -> hook ( 'afterDelete' ) ; $ delete -> owner -> commit ( ) ; $ this -> dsql = $ tmp ; $ this -> unload ( ) ; return $ this ; }
Deletes record matching the ID
Deletes record matching the ID