From 7b0af659a997990452de073a8f091cbdd469dc3c Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 2 May 2013 23:12:38 -0400 Subject: [PATCH] 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. --- lib/Cake/Model/Datasource/DboSource.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index d20dbe9aa..97f7fb567 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -1529,7 +1529,6 @@ class DboSource extends DataSource { 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 @@ class DboSource extends DataSource { 'alias' => $association, 'group' => null )); - $query += array('order' => $assocData['order'], 'limit' => $assocData['limit']); } else { $join = array( 'table' => $linkModel, @@ -1586,6 +1584,7 @@ class DboSource extends DataSource { 'alias' => $association, 'order' => $assocData['order'], 'limit' => $assocData['limit'], + 'offset' => $assocData['offset'], 'group' => null ); break; @@ -1613,6 +1612,7 @@ class DboSource extends DataSource { $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),