AndyB
Well-known member
I'm trying to create a finder that selects certain threads. One of the criteria is to only select nodeIds if viewable, then further eliminate selections using the other ->where statements.
My question is the ->whereOr appears to override the ->where conditions below it. I suspect I need another AND somewhere but I'm not able to determine the correct syntax.
Thank you for your help.
My question is the ->whereOr appears to override the ->where conditions below it. I suspect I need another AND somewhere but I'm not able to determine the correct syntax.
PHP:
$nodeRepo = $this->repository('XF:Node');
$nodes = $nodeRepo->getNodeList();
$nodeIds = $nodes->keys();
$conditions[] = ['node_id', $nodeIds];
$finder = \XF::finder('XF:Thread');
$results1 = $finder
->where('title', 'LIKE', $searchWord1, '%?%')
->where('title', 'LIKE', $searchWord2, '%?%')
->where('title', 'LIKE', $searchWord3, '%?%')
->where('discussion_state', '=', 'visible')
->where('discussion_state', '<>', 'redirect')
->where('post_date', '>=', $gte)
->where('thread_id', '<>', $currentThreadId)
->whereOr($conditions)
->order('post_date', 'DESC')
->limit($maximumResults1)->fetch()->toArray();
Thank you for your help.
Last edited: