diff --git a/src/Doctrine/Helpers/FieldHelper.php b/src/Doctrine/Helpers/FieldHelper.php index d1c9eee6b..d8654af66 100644 --- a/src/Doctrine/Helpers/FieldHelper.php +++ b/src/Doctrine/Helpers/FieldHelper.php @@ -87,13 +87,11 @@ public static function addOrderByFieldValues(QueryBuilder $qb, string $field_exp $key = 'field2_' . md5($field_expr); - //If we are on MySQL, we can just use the FIELD function - if ($db_platform instanceof AbstractMySQLPlatform) { + //If we are on MySQL, we can just use the FIELD function, for postgres we can use our custom defined one + if ($db_platform instanceof AbstractMySQLPlatform || $db_platform instanceof PostgreSQLPlatform) { $qb->orderBy("FIELD($field_expr, :field_arr)", $order); } else { - //Generate a unique key from the field_expr - - //Otherwise we have to it using the FIELD2 function + //Otherwise use the portable version using string concatenation self::addSqliteOrderBy($qb, $field_expr, $key, $values, $order); }