• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Fixed Finder for LatestBlogEntries widget is missing relation Blog

Kirby

Member
Showcase
UBS
UBS Version
2.3.8
XenForo Version
2.3.6
PHP Version
8.3.20
Database & Version
MariaDB 10.11.11
Are there any errors being throw?
No
The finder used to query blog entries in XenAddons\UBS\Widget\LatestBlogEntries::render() is missing relation Blog
This causes additional queries when checking canView()

Might also affect other widgets?

As Blog is required often (always?) it might make sense to add this to defaultWith
 
Done...

PHP:
/** @var \XenAddons\UBS\Finder\BlogEntryItem $finder */
        $finder = $this->finder('XenAddons\UBS:BlogEntryItem');
        
        $finder
            ->where('blog_entry_state', 'visible')
            ->with('Blog', 'Blog.CoverImage', 'CoverImage', 'User');

This is probably an issue in other Widget Definitions for UBS.
 
As Blog is required often (always?) it might make sense to add this to defaultWith
Agreed, not sure how I missed that one, but just updated the BlogEntryItem Entity to set Blog as a default relation.

Selection_794.png

If you find more of these, let me know asap so I can get these into the next release.
 
PHP:
->with('Blog', 'Blog.CoverImage', 'CoverImage', 'User');

Hmm, aren't Blog.CoverImage and CoverImage only required if Display style isn't Simple?

And this code seems to be missing [ and ], so 'Blog.CoverImage' would be used for param mustExist and the following relations would be ignored.
 
Last edited:
  • Haha
Reactions: Bob
PHP:
->with('Blog', 'Blog.CoverImage', 'CoverImage', 'User');

And this code seems to be missing [ and ], so 'Blog.CoverImage' would be used for param mustExist and the following relations would be ignored.

Whoops on the [] it is 6:52 AM here and not had my coffee yet!

PHP:
        /** @var \XenAddons\UBS\Finder\BlogEntryItem $finder */
        $finder = $this->finder('XenAddons\UBS:BlogEntryItem');
    
        $finder
            ->where('blog_entry_state', 'visible')
            ->with(['Blog', 'User']);

Hmm, aren't Blog.CoverImage and CoverImage only required if Display style isn't Simple?
Ya, that is covered by the fullCategory Alias, which in turn includes the full Alias (which includes Blog and Blog.CoverImage relations).

PHP:
        if ($options['style'] != 'simple')
        {
            $finder->with('fullCategory');
        }

Selection_795.png
 
Back
Top