Update PartSearchFilter.php

This commit is contained in:
d-buchmann 2026-02-16 09:59:50 +01:00 committed by GitHub
parent e5b3507bcc
commit a131d1cd3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -145,7 +145,7 @@ class PartSearchFilter implements FilterInterface
//Use equal expression to just search for exact numeric matches
if ($search_dbId) {
$expressions[] = $queryBuilder->expr()->eq('part.id', ':id_exact');
params[] = new \Doctrine\ORM\Query\Parameter('id_exact', (int) $this->keyword,
$params[] = new \Doctrine\ORM\Query\Parameter('id_exact', (int) $this->keyword,
ParameterType::INTEGER);
}
@ -156,7 +156,7 @@ class PartSearchFilter implements FilterInterface
}, $fields_to_search);
//For regex, we pass the query as is, save html special chars
params[] = new \Doctrine\ORM\Query\Parameter('search_query', $this->keyword);
$params[] = new \Doctrine\ORM\Query\Parameter('search_query', $this->keyword);
} else {
//Escape % and _ characters in the keyword
$this->keyword = str_replace(['%', '_'], ['\%', '\_'], $this->keyword);