1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest XenForo_ControllerHelper_ForumThreadPost usage inside the controllers

Discussion in 'Closed Suggestions' started by xf_phantom, May 3, 2013.

  1. xf_phantom

    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?

    $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;))
    Luxus likes this.

Share This Page