From 00fbcec476325322b5c8ccacfc0d9cf982e30b70 Mon Sep 17 00:00:00 2001 From: Silas Joisten Date: Mon, 31 Oct 2022 08:14:08 +0200 Subject: [PATCH] Fix: Search --- src/Orm/EntityRepository.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Orm/EntityRepository.php b/src/Orm/EntityRepository.php index 512f33f628..1d2644b711 100644 --- a/src/Orm/EntityRepository.php +++ b/src/Orm/EntityRepository.php @@ -131,6 +131,7 @@ private function addSearchClause(QueryBuilder $queryBuilder, SearchDto $searchDt $isTextProperty = \in_array($propertyDataType, ['string', 'text', 'citext', 'array', 'simple_array']); $isGuidProperty = \in_array($propertyDataType, ['guid', 'uuid']); $isUlidProperty = 'ulid' === $propertyDataType; + $isJsonProperty = 'json' === $propertyDataType; if (!$isBoolean && !$isSmallIntegerProperty && @@ -138,12 +139,16 @@ private function addSearchClause(QueryBuilder $queryBuilder, SearchDto $searchDt !$isNumericProperty && !$isTextProperty && !$isGuidProperty && - !$isUlidProperty + !$isUlidProperty && + !$isJsonProperty ) { - $idClassName = (new \ReflectionProperty($entityDto->getFqcn(), $propertyName))->getType()->getName(); + $idClassType = (new \ReflectionProperty($entityDto->getFqcn(), $propertyName))->getType(); - $isUlidProperty = (new \ReflectionClass($idClassName))->isSubclassOf(Ulid::class); - $isGuidProperty = (new \ReflectionClass($idClassName))->isSubclassOf(Uuid::class); + if (null !== $idClassType) { + $idClassName = $idClassType->getName(); + $isUlidProperty = (new \ReflectionClass($idClassName))->isSubclassOf(Ulid::class); + $isGuidProperty = (new \ReflectionClass($idClassName))->isSubclassOf(Uuid::class); + } } // this complex condition is needed to avoid issues on PostgreSQL databases