Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GROUP BY error if sql_mode "ONLY_FULL_GROUP_BY" is used [3.x] #294

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function prepareQueryBeforeCount(xPDOQuery $criteria)
]);
}

$criteria->select('MIN(id) AS id, form, context_key');
$criteria->groupby('form');
$criteria->groupby('context_key');

Expand All @@ -70,7 +71,7 @@ public function prepareQueryBeforeCount(xPDOQuery $criteria)
*/
public function prepareRow(xPDOObject $object)
{
return array_merge($object->toArray(), [
return array_merge($object->toArray('', false, true), [
'encrypted' => $this->modx->getCount($this->classKey, [
'form' => $object->get('form'),
'context_key' => $object->get('context_key'),
Expand Down Expand Up @@ -99,4 +100,3 @@ public function getAvailableContexts()
return $contexts;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function prepareQueryBeforeCount(xPDOQuery $criteria)
'context_key:IN' => $this->getAvailableContexts()
]);

$criteria->select('MIN(id) AS id, form');
$criteria->groupby('form');

return $criteria;
Expand All @@ -75,7 +76,7 @@ public function prepareQueryBeforeCount(xPDOQuery $criteria)
*/
public function prepareRow(xPDOObject $object)
{
return $object->toArray();
return $object->toArray('', false, true);
}

/**
Expand Down