diff --git a/src/Bundle/Doctrine/ORM/ExpressionBuilder.php b/src/Bundle/Doctrine/ORM/ExpressionBuilder.php index 8b817a8a..b781c13c 100644 --- a/src/Bundle/Doctrine/ORM/ExpressionBuilder.php +++ b/src/Bundle/Doctrine/ORM/ExpressionBuilder.php @@ -209,7 +209,14 @@ private function resolveFieldByAddingJoins(string $field): string } } - $associationAlias = md5($rootAndAssociationField); + // Association alias can't start with a number + // Mapping numbers to letters will not increase the collision probability and not lower the entropy + $associationAlias = str_replace( + ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], + ['g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'], + md5($rootAndAssociationField) + ); + $this->queryBuilder->innerJoin($rootAndAssociationField, $associationAlias); $field = sprintf('%s.%s', $associationAlias, $remainder); }