Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299620

Drupal\Core\Config\Entity\Query\Condition::notExists() does not work when parent property is also missing.

$
0
0

Given the following code:

    $storage = $this->entityTypeManager->getStorage('group_type');
    $group_type_ids = $storage->getQuery()
      ->notExists('third_party_settings.subgroup')
      ->execute();

and there being a group type that does not have any third party settings, I'd expect to get said group type's ID from the query.

Instead, I receive nothing. This is because of the following lines in Condition::matchArray()

        if (is_array($data[$key])) {
          $new_parents = $parents;
          $new_parents[] = $key;
          if ($this->matchArray($condition, $data[$key], $needs_matching, $new_parents)) {
            return TRUE;
          }
        }
        // Failing the above block leads to FALSE return value.

So unless the full parent path to the property (in this case third_party_settings) is set, matchArray() will never get to call match() where it checks the IS NULL condition.


Viewing all articles
Browse latest Browse all 299620

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>