Reply to thread

Under some conditions, we need to add further relations when loading threads for a search forum (to avoid n additional queries).


This could be accomplished by passing $extraWith to \XF\Entity\SearchForumUserCache::getThreadsByPage(), but unfortunately this method is called rather in the middle of \XF\Pub\Controller\SearchForum::actionView() with no obviois option to set this parameter.


[php]

$threads = $userCache->getThreadsByPage($page, $perPage);

[/php]


So short of completely overwriting the action method (or using some rather ugly hack like setting a pseudo-global to change the bevaviour of \XF\Entity\SearchForumUserCache::getThreadsByPage(), calling parent and resetting the pseudo-global aferwards) I don't see a sane way to achive this.


Could this call be moved to its own method (similar to \XF:\Pub\Controller\Forum::applyForumFilters(), also passing $searchForum as a param) within the controller? This would allow to easily modify the behaviour.


Back
Top Bottom