Skip to content
Permalink
Browse files

Improved ->delete() now it accepts WHERE clauses

  • Loading branch information...
Klederson Bueno
Klederson Bueno committed Aug 20, 2010
1 parent 3b849f5 commit f6b4b09d4e7acd9a5f69abd7319f1b588d3fc58b
Showing with 3 additions and 3 deletions.
  1. +3 −3 app/libs/Dialect/Dialect.php
@@ -134,9 +134,9 @@ public function prepareDelete($pk) {
$pkField = $this->getModel()->getMap()->getPrimaryKey();
$pk = $pk == null ? $this->getModel()->getMap()->getFieldValue($pkField['field']['alias']) : $pk;
if(isset($pk) && !empty($pk) && $pk != null) {
$whereConditions = sprintf("WHERE %s='%s'",$pkField['field']['column'],$pk);
}
$pkField = $this->getModel()->getMap()->getPrimaryKey();
$whereConditions = $this->getWhereString($pk, $pkField);
$whereConditions = !empty($whereConditions) ? "WHERE " . $whereConditions : $whereConditions;
return $sql = $whereConditions == null ? null : sprintf("DELETE %s %s", $from, $whereConditions);
}

0 comments on commit f6b4b09

Please sign in to comment.
You can’t perform that action at this time.