Details
-
Bug
-
Resolution: Fixed
-
Medium
-
4.3.0beta1
-
None
Description
Gets following query error when mysql is in strict mode, so probably same on postgres:
Query error (1140): Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause. Query: SELECT count( * ) AS count
FROM ezfind_elevate_configuration WHERE contentobject_id='138' ORDER BY contentobject_id ASC
Here is a patch that solves the issue for me at least by using persistentObject's count method instead of custom code:
Index: extension/ezfind/classes/ezfindelevateconfiguration.php =================================================================== --- extension/ezfind/classes/ezfindelevateconfiguration.php (revision 4475) +++ extension/ezfind/classes/ezfindelevateconfiguration.php (working copy) @@ -176,15 +176,6 @@ $results = array(); $sortClause = $groupByLanguage ? array( 'language_code' => 'asc' ) : null; - if ( $countOnly ) - { - $limit = null; - $asObject = false; - $fieldFilters = array(); - $custom = array( array( 'operation' => 'count( * )', - 'name' => 'count' ) ); - } - $conds = array( 'contentobject_id' => $objectID ); if ( $languageCode and $languageCode !== '' ) $conds['language_code'] = array( array( $languageCode, self::WILDCARD ) ); @@ -201,14 +192,13 @@ } } - $rows = parent::fetchObjectList( self::definition(), $fieldFilters, $conds, $sortClause, $limit, $asObject, false, $custom ); - if ( $countOnly ) { - return $rows[0]['count']; + return parent::count( self::definition(), $conds ); } else { + $rows = parent::fetchObjectList( self::definition(), $fieldFilters, $conds, $sortClause, $limit, $asObject, false, $custom ); foreach( $rows as $row ) { if ( $groupByLanguage )