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

Not planned Support extra JOIN clauses in Model/Attachment.php

Right now the [bd] Attachment Store addon has to redundantly store various config options in every row of the xf_attachment_data table, because XF's Attachment model class doesn't allow for extra JOIN clauses. If it did, a separate table could be created to store those backend options without much performance impact (no additional queries).

I'd like to propose adding a static var $dataJoins in XenForo/Model/Attachment.php, similar to $dataColumns. It would contain one or more JOIN clauses that would be used in places like getAttachmentsByContentIds. In fact I've already implemented this, but I'd like to avoid having to maintain a custom version of XenForo if possible. I can post the diff for my changes, if that would be helpful.

Chris D

XenForo developer
Staff member
Although potentially a reasonable suggestion for XF1, I'm going to mark it as Not Planned as the system is totally different in XF2, and significant changes like this won't be added to XF1.

Arguably, there'd be nothing stopping an add-on from adding in their own joins, even in XF1, but certainly in XF2, using the new Entity and Relation system it is a lot easier. You can read more about that, here: https://xf2demo.xenforo.com/threads/whats-new-for-developers-in-xenforo-2-part-1.1297/
XF2 isn't out yet, and without even a firm release date yet it certainly won't be ready in time for my current project.

About XF1, how would an addon do what you're suggesting, without being able to modify core XF files?