Lack of interest [Developer Tool] New event listener: app_pre_setup - ability to group data registry entries to fetch

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

DragonByte Tech

Well-known member
At the moment, there is no way to tell XF2 to group a bunch of data registry entries into a single query. This means that if you have multiple add-ons installed that all use their own prefix system, or their own custom fields, then you are adding X number of additional queries to fetch each single xf_data_registry entry.

The change necessary would be extremely small.

In \XF\App find:
PHP:
$preLoadExtra = isset($options['preLoad']) ? $options['preLoad'] : [];
$this->preLoadData($preLoadExtra);

Add below:
PHP:
$preLoadExtra = [];
$this->fire('app_pre_setup', [$this, &$preLoadExtra]);

if (!empty($preLoadExtra)
{
    try
    {
        $this->registry()->get($preLoadExtra);
    }
    catch (\Exception $e) {}
}

Adding this above app_setup is essential since that's where we tend to fetch our data registry entries. This change would not break BC in any way that I can tell, as add-ons that have not yet been updated to take this feature into account would continue to load their data registry entries as normal.

Thanks!


Fillip
 
Upvote 4
This suggestion has been closed. Votes are no longer accepted.
At the moment, there is no way to tell XF2 to group a bunch of data registry entries into a single query. This means that if you have multiple add-ons installed that all use their own prefix system, or their own custom fields, then you are adding X number of additional queries to fetch each single xf_data_registry entry.

The change necessary would be extremely small.

In \XF\App find:
PHP:
$preLoadExtra = isset($options['preLoad']) ? $options['preLoad'] : [];
$this->preLoadData($preLoadExtra);

Add below:
PHP:
$preLoadExtra = [];
$this->fire('app_pre_setup', [$this, &$preLoadExtra]);

if (!empty($preLoadExtra)
{
    try
    {
        $this->registry()->get($preLoadExtra);
    }
    catch (\Exception $e) {}
}

Adding this above app_setup is essential since that's where we tend to fetch our data registry entries. This change would not break BC in any way that I can tell, as add-ons that have not yet been updated to take this feature into account would continue to load their data registry entries as normal.

Thanks!


Fillip
Were you able to find a solution to this?
 
Back
Top Bottom