Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Optimization on dbo datasource to not repeat ids in find. Fixes #601

Signed-off-by: mark_story <mark@mark-story.com>
  • Loading branch information...
commit 2d449295981fbcceb9217a82e680383e0ee41c02 1 parent 7d51952
Juan Basso jrbasso authored markstory committed
Showing with 3 additions and 3 deletions.
  1. +3 −3 cake/libs/model/datasources/dbo_source.php
6 cake/libs/model/datasources/dbo_source.php
View
@@ -924,6 +924,7 @@ function queryAssociation(&$model, &$linkModel, $type, $association, $assocData,
}
if (!empty($ins)) {
+ $ins = array_unique($ins);
$fetch = $this->fetchAssociated($model, $query, $ins);
}
@@ -955,10 +956,10 @@ function queryAssociation(&$model, &$linkModel, $type, $association, $assocData,
}
}
if (!empty($ins)) {
+ $ins = array_unique($ins);
if (count($ins) > 1) {
$query = str_replace('{$__cakeID__$}', '(' .implode(', ', $ins) .')', $query);
$query = str_replace('= (', 'IN (', $query);
- $query = str_replace('= (', 'IN (', $query);
} else {
$query = str_replace('{$__cakeID__$}',$ins[0], $query);
}
@@ -1060,7 +1061,6 @@ function fetchAssociated($model, $query, $ids) {
$query = str_replace('{$__cakeID__$}', implode(', ', $ids), $query);
if (count($ids) > 1) {
$query = str_replace('= (', 'IN (', $query);
- $query = str_replace('= (', 'IN (', $query);
}
return $this->fetchAll($query, $model->cacheQueries, $model->alias);
}
@@ -2179,7 +2179,7 @@ function conditionKeysToString($conditions, $quoteValues = true, $model = null)
}
} elseif (is_array($value) && !empty($value) && !$valueInsert) {
$keys = array_keys($value);
- if (array_keys($value) === array_values(array_keys($value))) {
+ if ($keys === array_values($keys)) {
$count = count($value);
if ($count === 1) {
$data = $this->__quoteFields($key) . ' = (';
Please sign in to comment.
Something went wrong with that request. Please try again.