[RSS Feed/News] Fetch thousands of rows via Finder / get also the necessary TO_MANY related data with ONE query for each relation

Status
Not open for further replies.

XenForo

Administrative
  • Thread starter
  • Admin
  • #1
Let's say we have to fetch all data via xF2 finder:
PHP:

$data = \XF::finder('Scandals\Addon:Data')->fetch();
This entity has two TO_MANY relations (one is the Attachments).

How could I prepare an output variable which will have all necessary data without leave xF2 to make individual queries for the extra TO_MANY relations?

I can get the primary keys of Data and then run one query for ALL attachments.
Example:
PHP:

Code:
        $output = [];
        $ids = [];
        foreach ($data AS $d)...

Read more

ادامه مطلب...
 
Status
Not open for further replies.
Back
Top Bottom