Skip to content

Commit 716b97b

Browse files
committed
adapt query to engine
1 parent 8a60695 commit 716b97b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Glpi/Asset/CustomFieldType/DropdownType.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
use Glpi\DBAL\QueryExpression;
4141
use Glpi\DBAL\QueryFunction;
4242

43+
use function Safe\preg_match;
44+
4345
class DropdownType extends AbstractType
4446
{
4547
public static function getName(): string
@@ -155,7 +157,7 @@ public function getSearchOption(): ?array
155157
$opt['joinparams']['condition'] = [
156158
QueryFunction::jsonContains([
157159
'REFTABLE.custom_fields',
158-
QueryFunction::cast('NEWTABLE.id', 'JSON'),
160+
preg_match('/-MariaDB/', $DB->getVersion()) ? 'NEWTABLE.id' : QueryFunction::cast('NEWTABLE.id', 'JSON'),
159161
new QueryExpression($DB::quoteValue('$."' . $this->custom_field->fields['id'] . '"')),
160162
]),
161163
];

0 commit comments

Comments
 (0)