joomla-cms
joomla-cms copied to clipboard
[4.4] Fix of unnecessary SQL query for Fields, get the field value already loaded by getFields()
Summary of Changes
The same as https://github.com/joomla/joomla-cms/pull/42861 but for j4
Remove unnecessary SQL query for the custom fields, during the form rendering.
FieldsHelper::getFields()
load the field value, however FieldsHelper::prepareForm()
also loading them wthout a reason.
Also removed some dead code.
Testing Instructions
Enable debug and debug query. Create a couple of Custom fields, let say 10. Open article editing.
Actual result BEFORE applying this Pull Request
Notice amount of query in debug. Let say 75
Expected result AFTER applying this Pull Request
The amount of query will be 10 less, 65
Link to documentations
Please select:
- [ ] Documentation link for docs.joomla.org:
- [x] No documentation changes for docs.joomla.org needed
- [ ] Pull Request link for manual.joomla.org:
- [x] No documentation changes for manual.joomla.org needed
@crommie @chmst @adj9 As you had tested PR #42861 , could you test this one here, too? It's the same as the other one, just for 4.4 instead of 5.1. Thanks in advance.
Does this also work when you fetch two articles within the same request. Pretty sure the second article gets the same rawvalue as the first one.
Nope https://github.com/joomla/joomla-cms/blob/d272577bbbc636284305538e2d76ba48a7a6b933/administrator/components/com_fields/src/Helper/FieldsHelper.php#L179-L185
Every time you call FieldsHelper::getFields
it will load new values.
I have tested this item :white_check_mark: successfully on e5e307bf2d0cd4b914ebfa130c7c25811d35ad60
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42882.
I have tested this item :white_check_mark: successfully on e5e307bf2d0cd4b914ebfa130c7c25811d35ad60
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42882.
RTC
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42882.
RTC
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42882.