You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a section (e.g. items) of entries with a MultiSelect type dynamic field (e.g. myDynamicField).
This section has about 250 entries
I have a PHP loop like this:
$items = craft\elements\Entry::find()->section('items')->limit(null)->all();
// this loop takes ages
foreach ($items as $item) {
// ...
$val = $item->myDynamicField; // by toggling this line, it makes about 50 seconds difference.
// ...
}
I realized by running this code block, it takes ages. As mentioned above, I narrowed it down by toggling the line of code to query the dynamic field's value, and found out it makes about 50 seconds difference.
Then I looked into the normalizeValue() function of your lewisjenkins\craftdynamicfields\fields\Multiselect, and found out it tries to render the options template, which I have some entry queries there to generate. You might need it for something else, but in this case (when we just try to access the field data like $item->myDynamicField), is there a way that we can just get the value stored in the database without running rendering the options?
The text was updated successfully, but these errors were encountered:
I realized by running this code block, it takes ages. As mentioned above, I narrowed it down by toggling the line of code to query the dynamic field's value, and found out it makes about 50 seconds difference.
Then I looked into the normalizeValue() function of your lewisjenkins\craftdynamicfields\fields\Multiselect, and found out it tries to render the options template, which I have some entry queries there to generate. You might need it for something else, but in this case (when we just try to access the field data like $item->myDynamicField), is there a way that we can just get the value stored in the database without running rendering the options?
The text was updated successfully, but these errors were encountered: