From cb955b5763f64a0c31c81371db698c1e78ee3d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Ram=C3=B3n=20L=C3=B3pez?= Date: Thu, 2 Jan 2014 22:40:13 +0100 Subject: delete() method is now compound primary keys aware --- idiorm.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/idiorm.php b/idiorm.php index d0e98c8..3ea98a7 100644 --- a/idiorm.php +++ b/idiorm.php @@ -1929,15 +1929,12 @@ * Delete this record from the database */ public function delete() { - $query = join(" ", array( + $query = array( "DELETE FROM", - $this->_quote_identifier($this->_table_name), - "WHERE", - $this->_quote_identifier($this->_get_id_column_name()), - "= ?", - )); - - return self::_execute($query, array($this->id()), $this->_connection_name); + $this->_quote_identifier($this->_table_name) + ); + $this->_add_id_column_conditions($query); + return self::_execute(join(" ", $query), is_array($this->id()) ? array_values($this->id()) : array($this->id()), $this->_connection_name); } /** -- cgit v1.2.3