From f39a11f2b5c416132d55c2e7da7a568159745b6b Mon Sep 17 00:00:00 2001 From: John Heathco Date: Wed, 2 Sep 2009 14:16:45 -0700 Subject: [PATCH] fixing #2032 --- classes/kohana/orm.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/classes/kohana/orm.php b/classes/kohana/orm.php index 4992adf..458858f 100644 --- a/classes/kohana/orm.php +++ b/classes/kohana/orm.php @@ -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; } /**