Skip to content

Commit

Permalink
Fix $not:null not working in filters - resolves #483 (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvesh3 committed Mar 16, 2022
1 parent c9e20a8 commit 1561fa5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/GraphQL/Helper.php
Expand Up @@ -126,10 +126,15 @@ public static function buildSqlCondition($defaultTable, $q, $op = null, $subject
if (array_search(strtolower($objectVar), $ops) !== false) {
$innerOp = $mappingTable[strtolower($objectVar)];
if ($innerOp == 'NOT') {
if (is_null($objectValue)) {
$parts[] = '( NOT ' . self::quoteAbsoluteColumnName($defaultTable, $key) . ' IS NULL)';
$valuePart = ' IS NULL';
if (!is_null($objectValue)) {
$valuePart = ' =' . $db->quote($objectValue) . ')';
}

if (isset($fieldMappingTable, $key)) {
$parts[] = '( NOT ' . $db->quoteIdentifier($key) . $valuePart . ')';
} else {
$parts[] = '( NOT ' . self::quoteAbsoluteColumnName($defaultTable, $key) . ' =' . $db->quote($objectValue) . ')';
$parts[] = '( NOT ' . self::quoteAbsoluteColumnName($defaultTable, $key) . $valuePart . ')';
}
} else {
$parts[] = '(' . self::quoteAbsoluteColumnName($defaultTable, $key) . ' ' . $innerOp . ' ' . $db->quote($objectValue) . ')';
Expand Down

0 comments on commit 1561fa5

Please sign in to comment.