I want to render a node with certain properties set. For example, I want to load every node which ONLY has field_a and the other fields are empty.

If I use

$this->nodeStorage->loadByProperties(['type' => 'node_type', 'field_a' => $value]);

-> this will load every node which has field_a, but the other fields are not necessarily empty. I tried setting all the other fields to null, but it throws an InvalidQueryException. How can I change that query to IS NULL or which function can I use?

1 Answer 1


loadByProperties() executes an entity query with ->condition() for each property. You can't use this for empty fields, you need


according to How get empty record on date field with entityQuery?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.