While tinkering with new code on a test project, I asked Bob from Xen Addons for some advice and help. His answers led to more questions, however, there were several gold nuggets in the answers. Due to my reliance on var_dump, the treasure was missed until this morning when I used print_r instead of var_dump.
There is a need to use join and a few other items in the option arrays.
Prepare methods in Models have important value.
$fetchOptions and $conditions
The original code included little use of the $fetchOptions and $conditions.
The advice was to use join. This took me some time to look at the constants located at the top of Thread.php model in XenForo as well as some other addons but I slowly got the hang of it.
As a side note, after interpreting the advice and doing some massive tinkering on my test project, it was clear the widget code in XenWord needed updating to include the use of join. I'll write about that in the XenWord DevLog. But for now, you can see the differences in the original lines and the second.
More important, adding the join helped eliminate having to instantiate a new class for the node_title because it was included in the returned array.
This morning's tinkering led to something even more interesting than using join. I'm a var_dump junky. It's how my code moved from Cowboy to "OK. Try this idiot." In my view, the best part of building something is figuring out how to unravel an array, pulling from Models, and not relying on Google search for answers to copy. It's all about thinking for myself.
Part of the second advice, though, was to use prepare methods found in the Model. Bluntly, I hadn't even considered it. I didn't even understand it. I tried a few things yesterday, got annoyed, and tinkered with a few other items. This morning was totally different.
In looking at the var_dump before the prepare and after showed a size difference in the array. The depth of var_dump wasn't great enough to see all the elements. I only noticed it when looking at the size difference of the arrays. Afterwards I noticed the message stating there were more elements...
To overcome the depth issue, I inserted in a print_r and immediately saw elements that were not being shown with the var_dump. Sure enough, many of the elements I needed for my little test project were in the array after using the prepare.
After more tinkering, I decided to make a dump.php file and require the file in my phptest files. The file contains two functions one function with a conditional to check if the variable is an array.