skip text search for email address if whitespaces

This commit is contained in:
Yuri Kuznetsov
2023-02-13 10:14:43 +02:00
parent 826c1734a2
commit fcc13ef10c
2 changed files with 19 additions and 0 deletions

View File

@@ -104,6 +104,14 @@ class DefaultFilter implements Filter
return;
}
if (
!str_contains($attribute, '.') &&
$this->metadataProvider->getFieldType($this->entityType, $attribute) === 'email' &&
str_contains($filter, ' ')
) {
return;
}
$expression = $filter;
if (!$skipWildcards) {

View File

@@ -120,6 +120,17 @@ class MetadataProvider
->getType();
}
public function getFieldType(string $entityType, string $field): ?string
{
$entityDefs = $this->ormDefs->getEntity($entityType);
if (!$entityDefs->hasField($field)) {
return null;
}
return $entityDefs->getField($field)->getType();
}
public function getRelationEntityType(string $entityType, string $link): ?string
{
$relationDefs = $this->ormDefs