Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stop calling limit() twice on the same data.

DboSource::limit() now follows its documented input types, passing an
already formatted LIMIT string will result in LIMIT 0. Remove useless
array merging as well.
  • Loading branch information...
commit 7b0af659a997990452de073a8f091cbdd469dc3c 1 parent 2096d3f
@markstory markstory authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Cake/Model/Datasource/DboSource.php
View
4 lib/Cake/Model/Datasource/DboSource.php
@@ -1529,7 +1529,6 @@ public function generateAssociationQuery(Model $model, $linkModel, $type, $assoc
if (empty($assocData['offset']) && !empty($assocData['page'])) {
$assocData['offset'] = ($assocData['page'] - 1) * $assocData['limit'];
}
- $assocData['limit'] = $this->limit($assocData['limit'], $assocData['offset']);
switch ($type) {
case 'hasOne':
@@ -1555,7 +1554,6 @@ public function generateAssociationQuery(Model $model, $linkModel, $type, $assoc
'alias' => $association,
'group' => null
));
- $query += array('order' => $assocData['order'], 'limit' => $assocData['limit']);
} else {
$join = array(
'table' => $linkModel,
@@ -1586,6 +1584,7 @@ public function generateAssociationQuery(Model $model, $linkModel, $type, $assoc
'alias' => $association,
'order' => $assocData['order'],
'limit' => $assocData['limit'],
+ 'offset' => $assocData['offset'],
'group' => null
);
break;
@@ -1613,6 +1612,7 @@ public function generateAssociationQuery(Model $model, $linkModel, $type, $assoc
$query = array(
'conditions' => $assocData['conditions'],
'limit' => $assocData['limit'],
+ 'offset' => $assocData['offset'],
'table' => $this->fullTableName($linkModel),
'alias' => $association,
'fields' => array_merge($this->fields($linkModel, $association, $assocData['fields']), $joinFields),
Please sign in to comment.
Something went wrong with that request. Please try again.