From 17406c546fac6b011d3d548a8014c9f8b33fca63 Mon Sep 17 00:00:00 2001 From: William Arin Date: Thu, 18 Jul 2024 01:12:32 +0200 Subject: [PATCH 1/2] fix: array to string conversion when normalizing criteria --- src/Bridge/Repository/NormalizerTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bridge/Repository/NormalizerTrait.php b/src/Bridge/Repository/NormalizerTrait.php index 7aac4ed..a847f0f 100644 --- a/src/Bridge/Repository/NormalizerTrait.php +++ b/src/Bridge/Repository/NormalizerTrait.php @@ -53,7 +53,7 @@ protected function normalizeCriteria( $resolvedValue = $ignoreValidation ? $value : $this->validateFieldValue($field, $value, $entityClassName); - $output[$field] = (string) $this->serializer->normalize($resolvedValue); + $output[$field] = $this->serializer->normalize($resolvedValue); } } From d4ddd8a61c20c48e11af13aa3a7a67372c9e18f7 Mon Sep 17 00:00:00 2001 From: William Arin Date: Thu, 18 Jul 2024 12:24:52 +0200 Subject: [PATCH 2/2] fix: wrongly formed parameters --- src/Bridge/Repository/AbstractEntityRepository.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Bridge/Repository/AbstractEntityRepository.php b/src/Bridge/Repository/AbstractEntityRepository.php index 8070592..ae7d2e7 100644 --- a/src/Bridge/Repository/AbstractEntityRepository.php +++ b/src/Bridge/Repository/AbstractEntityRepository.php @@ -229,7 +229,7 @@ public function getMappedMetaKey(string $fieldName, string $entityClassName = nu $mappedFields = $targetClass->getMappedFields(); } else { // BC layer, to be removed when MAPPED_FIELDS constant is removed - $mappedFields = (new \ReflectionClassConstant($targetClass, 'MAPPED_FIELDS',))->getValue(); + $mappedFields = (new \ReflectionClassConstant($targetClass, 'MAPPED_FIELDS'))->getValue(); } if ( @@ -257,7 +257,7 @@ public function isFieldMapped(string $fieldName, string $entityClassName = null) $mappedFields = $targetClass->getMappedFields(); } else { // BC layer, to be removed when MAPPED_FIELDS constant is removed - $mappedFields = (new \ReflectionClassConstant($targetClass, 'MAPPED_FIELDS',))->getValue(); + $mappedFields = (new \ReflectionClassConstant($targetClass, 'MAPPED_FIELDS'))->getValue(); } if ( @@ -408,10 +408,7 @@ private function getWhereExpressionFromCriteriaField( string $entityClassName = null, int $aliasNumber = null, ): CompositeExpression { - $snakeField = u($field) - ->snake() - ->toString() - ; + $snakeField = str_replace('.', '_', u($field) ->snake() ->toString()); $parameter = ":{$snakeField}"; $operator = '='; $prefixedField = $field; @@ -476,10 +473,7 @@ private function getWhereExpressionFromCriteriaField( ])] private function flattenOperand(QueryBuilder $queryBuilder, Operand $operand, string $field, mixed $value): array { - $snakeField = u($field) - ->snake() - ->toString() - ; + $snakeField = str_replace('.', '_', u($field) ->snake() ->toString()); $parameter = ":{$snakeField}"; $operator = $operand->getOperator();