Commit 46d094a0 authored by catch's avatar catch

Issue #3154858 by kristiaanvandeneynde:...

Issue #3154858 by kristiaanvandeneynde: Drupal\Core\Config\Entity\Query\Condition::notExists() does not work when parent property is also missing

(cherry picked from commit 87468a5d)
parent 13da1a75
......@@ -130,6 +130,11 @@ protected function matchArray(array $condition, array $data, array $needs_matchi
return TRUE;
}
}
// If the parent does not exist, it's safe to say the actual property
// we're checking for is also NULL.
elseif ($condition['operator'] === 'IS NULL') {
return TRUE;
}
}
// Only try to match a scalar if there are no remaining keys in
// $needs_matching as this indicates that we are looking for a specific
......
......@@ -606,6 +606,16 @@ public function testDotted() {
->notExists('array')
->execute();
$this->assertResults([]);
// Make sure that "IS NULL" and "IS NOT NULL" work correctly when the dotted
// path cannot be fully followed.
$this->queryResults = $this->entityStorage->getQuery()
->exists('does.not.exist')
->execute();
$this->assertResults([]);
$this->queryResults = $this->entityStorage->getQuery()
->notExists('does.not.exist')
->execute();
$this->assertResults($all);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment