Skip to content

Commit

Permalink
fix: Problem to use partial searchFilter with an integer as input.
Browse files Browse the repository at this point in the history
SQL Server does not automatically cast an integer to a string in
the concatenation with + method (...WHERE field1 LIKE :param1 + :param2)
The CONCAT function is not available before the 2012 version.

I so simply force the casting when the searchFilter is not of type exact.
  • Loading branch information
Hogren authored and HEGRON Florian committed Jul 17, 2021
1 parent 4f363fc commit 6622fcd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Bridge/Doctrine/Orm/Filter/SearchFilter.php
Expand Up @@ -219,7 +219,9 @@ protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuild
}

$queryBuilder->andWhere($queryBuilder->expr()->orX(...$ors));
array_walk($parameters, [$queryBuilder, 'setParameter']);
foreach ($parameters as $value => $name) {
$queryBuilder->setParameter($name, (string) $value);
}
}

/**
Expand Down

0 comments on commit 6622fcd

Please sign in to comment.