Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix array to string conversion when normalizing criteria #66

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/Bridge/Repository/AbstractEntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Repository/NormalizerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Loading