From 55183ec386e494c65ea9146737ebaf77fe59a0d7 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 14 Sep 2011 10:57:29 +0200 Subject: [PATCH] BUGFIX Reset WHERE clause in SQLMap->getItem() to ensure it can be invoked more than once --- model/SQLMap.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/model/SQLMap.php b/model/SQLMap.php index af6d7323c..5e997e788 100644 --- a/model/SQLMap.php +++ b/model/SQLMap.php @@ -38,8 +38,10 @@ class SQLMap extends Object implements IteratorAggregate { public function getItem($id) { if($id) { $baseTable = reset($this->query->from); - $this->query->where[] = "$baseTable.\"ID\" = $id"; + $where = "$baseTable.\"ID\" = $id"; + $this->query->where[sha1($where)] = $where; $record = $this->query->execute()->first(); + unset($this->query->where[sha1($where)]); if($record) { $className = $record['ClassName']; $obj = new $className($record);