How do I query two relationship fields where one relationship MUST be empty? I have two relationship fields. I am trying to query all entries where the first field is related to a particular element and the second field is related to nothing. Here is how I thought it would work but it doesn't.

$criteria-&gt;relatedTo = ['and',
[
    'targetElement' =&gt; anElementId,
    'field'         =&gt; 'relationshipOne'
],
[
    'targetElement' =&gt; null, // also tried ":empty:"
    'field'         =&gt; 'relationshipTwo'
]];
Splitting the criteria up like this works.

$criteria-&gt;relatedTo = [
    'targetElement' =&gt; anElementId,
    'field'         =&gt; 'relationshipOne'
];
$criteria-&gt;relationshipTwo = ':empty:';


Thanks to @carlcs in the Craft Slack channel.