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()->elements->getCriteria(ElementType::Entry);
$criteria->limit = NULL;
foreach ($fields AS $field) {
$criteria->$field = ':notempty:';
}
$entries = $criteria->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 && X <> '') OR (Y IS NOT NULL && Y <> '')