modifyEntrySources hook, comparing two field values Is it possible with the modifyEntrySources hook to query a field value against another fields value? Example:

Two fields are present on the entry section this hook targets


fieldParentId
fieldId


I want to be able to query in the entry source definition if the fieldParentId is the same as the fieldId to return only those records in the entry list within Craft that match this. I'm not sure this is possible, or if there is a special syntax required within the criteria array to do it?
A workaround solution was to essentially do an criteria on the section, return all the records, use a conditional to find out which records have the same "parent ID" and ID", stores those in an array and then use the id criteria for the entry source.

Something like:

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = 'theSection';
$criteria-&gt;limit = null;
$articles = $criteria-&gt;find();

// For storing matching entries on the conditional below
$ids = [];

foreach ($entries as $entry)
{
     if($entry-&gt;fieldParentId == $entry-&gt;fieldId)
     {
         array_push($ids, $entry-&gt;id);
     }
}


This will then provide a list of ids that match the required criteria, which can then be used for a specific entry source.

This has performance issues though, because you have to get the entire list of entries first each time.