Skip to content

Commit

Permalink
fixing #2032
Browse files Browse the repository at this point in the history
  • Loading branch information
jheathco committed Sep 2, 2009
1 parent 32ad975 commit f39a11f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions classes/kohana/orm.php
Original file line number Diff line number Diff line change
Expand Up @@ -887,21 +887,21 @@ public function save_all()
*/
public function delete($id = NULL)
{
if ($id !== NULL)
if ($id === NULL)
{
// Use the the primary key value
$this->_object[$this->_primary_key] = $id;
$id = $this->pk();
}

if ( ! $this->empty_pk())
if ( ! empty($id) OR $id === '0')
{
// Delete this object
// Delete the object
DB::delete($this->_table_name)
->where($this->_primary_key, '=', $id)
->execute($this->_db);
}

return $this->clear();
return $this;
}

/**
Expand Down

0 comments on commit f39a11f

Please sign in to comment.