My question is rather simple and I have searched quite a bit for the answer with no result. My view produces below SQL (simplified):
SELECT stuff FROM tableA LEFT JOIN tableB LEFT JOIN tableC ON stuff WHERE (( (MY_CONTEXTUAL_FILTER = '5' ) )AND(( (MY_NORMAL_FILTER IS NULL ) )))
All I want to do is to change that AND between the contextual filter and normal filter. I have tried to change all ANDs (including
set_group_operator()) to OR and it does not change my AND.
Also need to mention it is an 'Entity Reference' display which I am trying to achieve the above on. Views version 7.x-3.7.
In order to achieve the above, I also tried
hook_views_pre_execute() as below:
$old_query = (string)$view->query->query(); $new_query = str_replace('AND', 'OR', $old_query); $view->build_info['query']=$new_query;
But that doesn't work and throws and error. I know they are different approaches with different issues but both are trying to solve one problem.