Skip to content

Commit

Permalink
Add BINARY function in Doctrine queries to allow a case sensitive req…
Browse files Browse the repository at this point in the history
…uest when searching for matching Tab
  • Loading branch information
jolelievre committed Feb 3, 2025
1 parent 87fa381 commit 440585b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/config/doctrine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ doctrine:
dql:
string_functions:
regexp: DoctrineExtensions\Query\Mysql\Regexp
binary: DoctrineExtensions\Query\Mysql\Binary
3 changes: 2 additions & 1 deletion src/PrestaShopBundle/Entity/Repository/TabRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ public function getIdByClassName(string $className): int
if (!isset($this->cachedTabIds[$className])) {
$result = $this->createQueryBuilder('t')
->select('t.id, t.className')
->where('t.className = :className')
// Use binary to force a case-sensitive comparison (HOME and Home are different)
->where('t.className = BINARY(:className)')
->andWhere('t.id != 0')
->setParameter('className', $className)
->getQuery()
Expand Down

0 comments on commit 440585b

Please sign in to comment.