Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5eb5f3b

Browse files
committed
Use the UUID regex defined in symfony/uid instead of the old regex which cannot handle v6 UUIDs (for v6 UUIDs see https://symfony.com/doc/current/components/uid.html#generating-uuids)
1 parent 8d02402 commit 5eb5f3b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/Orm/EntityRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use EasyCorp\Bundle\EasyAdminBundle\Form\Type\ComparisonType;
1616
use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;
1717
use Symfony\Component\Uid\Ulid;
18+
use Symfony\Component\Uid\Uuid;
1819

1920
/**
2021
* @author Javier Eguiluz <[email protected]>
@@ -64,7 +65,7 @@ private function addSearchClause(QueryBuilder $queryBuilder, SearchDto $searchDt
6465
$isNumericQuery = is_numeric($query);
6566
$isSmallIntegerQuery = ctype_digit($query) && $query >= -32768 && $query <= 32767;
6667
$isIntegerQuery = ctype_digit($query) && $query >= -2147483648 && $query <= 2147483647;
67-
$isUuidQuery = 1 === preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i', $query);
68+
$isUuidQuery = Uuid::isValid($query);
6869
$isUlidQuery = Ulid::isValid($query);
6970

7071
$dqlParameters = [

0 commit comments

Comments
 (0)