Home
Forums
New posts
Search forums
What's new
New posts
New media
New media comments
New resources
New profile posts
Latest activity
Media
New media
New comments
Search media
Resources
Latest reviews
Search resources
Members
Current visitors
New profile posts
Search profile posts
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
XenForo bug reports
Resolved bug reports
Adding additional relations for search forums requires ugly hack
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Kirby" data-source="post: 1564990" data-attributes="member: 1059"><p>Yes, definitly. If it is not passed it would most likely require a bit more code than necessary as we would only need additional joins depending on the specific search forum that is going to be displayed.</p><p></p><p>The new method [ICODE]getUserCacheExtraWith()[/ICODE] does not have direct access to this information - to get it I would probably have to duplicate some code from [ICODE]actionView()[/ICODE] which seems unnecessary overhead if it could just be passed <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>Ideally the patch could be smth. like</p><p></p><p>[CODE="diff"]diff --git a/src/XF/Pub/Controller/SearchForum.php b/src/XF/Pub/Controller/SearchForum.php</p><p>index e9795faddf..8b05b847d9 100644</p><p>--- a/src/XF/Pub/Controller/SearchForum.php</p><p>+++ b/src/XF/Pub/Controller/SearchForum.php</p><p>@@ -56,7 +56,7 @@ public function actionView(ParameterBag $params)</p><p> $searchForum</p><p> );</p><p> </p><p>- $threads = $userCache->getThreadsByPage($page, $perPage);</p><p>+ $threads = $userCache->getThreadsByPage($page, $perPage, $this->getUserCacheExtraWith($searchForum));</p><p> </p><p> $canInlineMod = false;</p><p> foreach ($threads AS $thread)</p><p>@@ -108,6 +108,14 @@ protected function getSearchForumViewExtraWith()</p><p> return ['Cache', "UserCaches|{$visitor->user_id}"];</p><p> }</p><p> </p><p>+ /**</p><p>+ * @return string[]</p><p>+ */</p><p>+ protected function getUserCacheExtraWith(\XF\Entity\SearchForum $searchForum): array</p><p>+ {</p><p>+ return [];</p><p>+ }</p><p>+</p><p> /**</p><p> * @return \XF\Mvc\Reply\AbstractReply</p><p> */[/CODE]</p><p></p><p>This way the SearchForum entity could be accessed directly.</p></blockquote><p></p>
[QUOTE="Kirby, post: 1564990, member: 1059"] Yes, definitly. If it is not passed it would most likely require a bit more code than necessary as we would only need additional joins depending on the specific search forum that is going to be displayed. The new method [ICODE]getUserCacheExtraWith()[/ICODE] does not have direct access to this information - to get it I would probably have to duplicate some code from [ICODE]actionView()[/ICODE] which seems unnecessary overhead if it could just be passed :) Ideally the patch could be smth. like [CODE="diff"]diff --git a/src/XF/Pub/Controller/SearchForum.php b/src/XF/Pub/Controller/SearchForum.php index e9795faddf..8b05b847d9 100644 --- a/src/XF/Pub/Controller/SearchForum.php +++ b/src/XF/Pub/Controller/SearchForum.php @@ -56,7 +56,7 @@ public function actionView(ParameterBag $params) $searchForum ); - $threads = $userCache->getThreadsByPage($page, $perPage); + $threads = $userCache->getThreadsByPage($page, $perPage, $this->getUserCacheExtraWith($searchForum)); $canInlineMod = false; foreach ($threads AS $thread) @@ -108,6 +108,14 @@ protected function getSearchForumViewExtraWith() return ['Cache', "UserCaches|{$visitor->user_id}"]; } + /** + * @return string[] + */ + protected function getUserCacheExtraWith(\XF\Entity\SearchForum $searchForum): array + { + return []; + } + /** * @return \XF\Mvc\Reply\AbstractReply */[/CODE] This way the SearchForum entity could be accessed directly. [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
XenForo bug reports
Resolved bug reports
Adding additional relations for search forums requires ugly hack
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top