Lack of interest XenForo_ControllerHelper_ForumThreadPost usage inside the controllers

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

xf_phantom

Well-known member
Wouldn't it be better to fetch the helper data "before" the action or cache it or do something else to reduce the queries:P?


e.g.
PHP:
$forumId = $this->_input->filterSingle('node_id', XenForo_Input::UINT);
$forumName = $this->_input->filterSingle('node_name', XenForo_Input::STRING);
 
$ftpHelper = $this->getHelper('ForumThreadPost');
$forum = $ftpHelper->assertForumValidAndViewable($forumId ? $forumId : $forumName);
is called in most of the forum action methods

If an addon is extending an action and needs to run before the original xf action, it needs to call in 99% of the cases the controller helpers too.
With 4 addons this results in 4 extra queries on forum_view and 8 extra queries on thread_view because of the forum AND thread query
If you would fetch the "important forum & thread data" BEFORE the action or safe it for later use, we wouldn't need to run the same code again and again and again.


Idea1: safe the data from the helpers and fetch them only if needed (e.g. different fetchOptions)
Idea 2 is to run the helper BEFORE the action and safe the data in the controller, so all childclasses would have access
Idea 3: Something like the symfony2 param converter ( http://symfony.com/doc/master/bundles/SensioFrameworkExtraBundle/annotations/converters.html would be GREAT and reduce the work extreeeeeem;))
 
Upvote 1
This suggestion has been closed. Votes are no longer accepted.
Top Bottom