I have nodes that have embedded Media (images) and also links to other content (nodes and media). Through hooks I populate custom fields to store those references, this is a multi-value entity reference. Also, since the entity reference is an int, the default filter is equals, between, less or greater, etc - 'not in' is not even possible via the UI.
What I would like to do is create a View that would find content where those references are no longer valid; ie. the referenced entity has been removed.
I attempted to use a few hook_views_XXX functions to alter the query or filter the results after execution. Altering the query makes the most sense, but am not sure how to add an IN clause for a custom field. Filtering the results 'post_execute' will be cumbersome since there is not a way good way to get all results before the pager is initialized.
Creating a custom views filter is going to be the next attempt, but would think/hope that there is a simpler way. Is there something I am overlooking? How can the 'query_alter' be done?