Skip to content

Commit

Permalink
Fixing DboSource::group() to test for virtual fields when first param…
Browse files Browse the repository at this point in the history
…eter is not an array
  • Loading branch information
lorenzo committed Jan 11, 2010
1 parent cecfd72 commit 3fe4b46
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cake/libs/model/datasources/dbo_source.php
Expand Up @@ -2330,14 +2330,16 @@ function order($keys, $direction = 'ASC', $model = null) {
*/
function group($group, $model = null) {
if ($group) {
if (is_array($group)) {
foreach($group as $index => $key) {
if ($model->isVirtualField($key)) {
$group[$index] = '(' . $model->getVirtualField($key) . ')';
}
if (!is_array($group)) {
$group = array($group);
}

foreach($group as $index => $key) {
if ($model->isVirtualField($key)) {
$group[$index] = '(' . $model->getVirtualField($key) . ')';
}
$group = implode(', ', $group);
}
$group = implode(', ', $group);
return ' GROUP BY ' . $this->__quoteFields($group);
}
return null;
Expand Down

0 comments on commit 3fe4b46

Please sign in to comment.