From c0ddbd5bc3d168ed13bc99d8f5cee5af68cdcaa2 Mon Sep 17 00:00:00 2001 From: halftrainedharry Date: Mon, 8 Jul 2024 14:45:44 +0200 Subject: [PATCH] Fix queries for sql_mode only_full_group_by --- .../formit/src/FormIt/Processors/Mgr/Encryption/GetList.php | 4 ++-- .../formit/src/FormIt/Processors/Mgr/Forms/GetForms.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/components/formit/src/FormIt/Processors/Mgr/Encryption/GetList.php b/core/components/formit/src/FormIt/Processors/Mgr/Encryption/GetList.php index 00c57ac..e3aa747 100644 --- a/core/components/formit/src/FormIt/Processors/Mgr/Encryption/GetList.php +++ b/core/components/formit/src/FormIt/Processors/Mgr/Encryption/GetList.php @@ -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'); @@ -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'), @@ -99,4 +100,3 @@ public function getAvailableContexts() return $contexts; } } - diff --git a/core/components/formit/src/FormIt/Processors/Mgr/Forms/GetForms.php b/core/components/formit/src/FormIt/Processors/Mgr/Forms/GetForms.php index 0dceb68..814fb4e 100644 --- a/core/components/formit/src/FormIt/Processors/Mgr/Forms/GetForms.php +++ b/core/components/formit/src/FormIt/Processors/Mgr/Forms/GetForms.php @@ -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; @@ -75,7 +76,7 @@ public function prepareQueryBeforeCount(xPDOQuery $criteria) */ public function prepareRow(xPDOObject $object) { - return $object->toArray(); + return $object->toArray('', false, true); } /**