aboutsummaryrefslogtreecommitdiffstats
path: root/Controller.php
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mekanisti.fi>2009-11-09 14:24:41 +0200
committerFilipp Lepalaan <filipp@mekanisti.fi>2009-11-09 14:24:41 +0200
commit7034b50d0d50612ca52273aacabd2b3189c968d8 (patch)
tree85442aae9f9a1e124c262f1c33242a2b58433db6 /Controller.php
parent71eebcefb57763451d3cc2749d2ed9e181887157 (diff)
downloadmain-7034b50d0d50612ca52273aacabd2b3189c968d8.tar.gz
main-7034b50d0d50612ca52273aacabd2b3189c968d8.tar.bz2
main-7034b50d0d50612ca52273aacabd2b3189c968d8.zip
Limit on controller->delete
Diffstat (limited to 'Controller.php')
-rw-r--r--Controller.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/Controller.php b/Controller.php
index 5432673..458d3a3 100644
--- a/Controller.php
+++ b/Controller.php
@@ -254,7 +254,7 @@ class Controller
/**
* Delete this thing
*/
- protected function delete($where)
+ protected function delete($where, $limit = "")
{
if (empty($where)) {
return App::error("Delete without arguments");
@@ -262,8 +262,12 @@ class Controller
list($key, $value) = each($where);
+ if ($limit) {
+ $limit = " LIMIT $limit";
+ }
+
$data = array(":{$key}" => $value);
- $sql = "DELETE FROM `{$this->table}` WHERE `{$key}` = :{$key}";
+ $sql = "DELETE FROM `{$this->table}` WHERE `{$key}` = :{$key} $limit";
return Db::query($sql, $data);