- Status changed to RTBC
almost 2 years ago 11:53pm 3 February 2023 - πΊπΈUnited States smustgrave
Passed D10
Confirmed the tests fail without the fixSome predictions failed: Double\ConfigFactoryInterface\P1: No calls have been made that match: Double\ConfigFactoryInterface\P1->loadMultiple(exact(["config_test.dynamic.1"])) but expected at least one. Recorded `loadMultiple(...)` calls: - loadMultiple(["config_test.dynamic.1", "config_test.dynamic.2"]) @ core/lib/Drupal/Core/Config/Entity/Query/Query.php:222 No calls expected that match: Double\ConfigFactoryInterface\P1->loadMultiple(exact(["config_test.dynamic.1", "config_test.dynamic.2"])) but 1 was made: - loadMultiple(["config_test.dynamic.1", "config_test.dynamic.2"]) @ core/lib/Drupal/Core/Config/Entity/Query/Query.php:222
Looks good
- Status changed to Needs work
almost 2 years ago 11:00am 6 February 2023 - π¬π§United Kingdom catch
+++ b/core/lib/Drupal/Core/Config/Entity/Query/Query.php @@ -135,6 +135,11 @@ protected function loadRecords() { $conditions = $this->condition->conditions(); + usort($conditions, function ($a, $b) use ($id_key) { + $a_score = ($a['field'] == $id_key) ? 1 : 0; + $b_score = ($b['field'] == $id_key) ? 1 : 0; + return $b_score - $a_score; + });
This needs an explanation as to why we're doing the sort. The test coverage will help us not to break it, but I still can't work out why we'd do this just reading the code.
I also wonder a bit - if the ID key can only appear once in conditions, do we actually need to sort, or could we find it and move its position in the array explicitly?