Element Criteria Model: filtering by empty values I'm trying to use the Element Criteria Model to retrieve all entries where value X or value Y is not null?

I can get all entries where values and X and Y are not empty but not sure how to achieve this with either X or Y being not empty. any thoughts?

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;limit = NULL;

foreach ($fields AS $field) {
    $criteria-&gt;$field = ':notempty:';
}

$entries = $criteria-&gt;find();


This is what I have for AND but not sure how best to go about achieving the same query for OR.

An equivalent SQL query would be something along lines of WHERE (X IS NOT NULL &amp;&amp; X &lt;&gt; '') OR (Y IS NOT NULL &amp;&amp; Y &lt;&gt; '')
Okay, doesn't seem to be the most elegant but the only way I could achieve this was by carrying out the entries criteria query within my $fields loop. So, for example:

$entries = [];

foreach ($fields AS $field) {
    $criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
    $criteria-&gt;limit = NULL;
    $criteria-&gt;$field = ':notempty:';
    $tmpEntries = $criteria-&gt;find();

    $entries = array_merge($entries,$tmpEntries);
}