RTC bug RMDQ PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
25 Feb 2024

Summary of Changes

The same as #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:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org:
  • No documentation changes for manual.joomla.org needed
avatar Fedik Fedik - open - 25 Feb 2024
avatar Fedik Fedik - change - 25 Feb 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 25 Feb 2024
Category Administration com_fields
avatar Fedik Fedik - change - 25 Feb 2024
Title
[4.4] Get the field value already loaded by getFields()
[4.4] Fix of unnecessary SQL query for Fields, get the field value already loaded by getFields()
avatar Fedik Fedik - edited - 25 Feb 2024
avatar richard67
richard67 - comment - 25 Feb 2024

@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.

avatar laoneo
laoneo - comment - 25 Feb 2024

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.

avatar Fedik
Fedik - comment - 25 Feb 2024

Nope

foreach ($fields as $key => $original) {
/*
* Doing a clone, otherwise fields for different items will
* always reference to the same object
*/
$field = clone $original;

Every time you call FieldsHelper::getFields it will load new values.

avatar ceford ceford - test_item - 26 Feb 2024 - Tested successfully
avatar ceford
ceford - comment - 26 Feb 2024

I have tested this item ✅ successfully on e5e307b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42882.

avatar chmst chmst - test_item - 26 Feb 2024 - Tested successfully
avatar chmst
chmst - comment - 26 Feb 2024

I have tested this item ✅ successfully on e5e307b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42882.

avatar chmst
chmst - comment - 26 Feb 2024

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42882.

avatar richard67 richard67 - change - 26 Feb 2024
Status Pending Ready to Commit
Labels Added: bug PR-4.4-dev
avatar richard67
richard67 - comment - 26 Feb 2024

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42882.

avatar Quy Quy - change - 26 Feb 2024
Labels Added: RTC
avatar Fedik Fedik - change - 7 Mar 2024
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2024-03-07 09:13:50
Closed_By Fedik
Labels Added: RMDQ
avatar Fedik Fedik - close - 7 Mar 2024

Add a Comment

Login with GitHub to post a comment