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.
This commit is contained in:
mark_story 2013-05-02 23:12:38 -04:00
parent 2096d3f632
commit 7b0af659a9

View file

@ -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),