The Needs Review Queue Bot → tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- 🇬🇧United Kingdom hugronaphor
Edge-case:
I have 0, 1 or 2 entities to load and the order matters in my case.
For performance reasons I want to load them `loadMultiple()`$nodeIds = [ $queryPrev->execute()->fetchField(), $queryNext->execute()->fetchField(), ]; $nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($nodeIds); return [ '#prev' => !empty($nodes[$nodeIds[0]]) ? $nodes[$nodeIds[0]] : NULL, '#next' => !empty($nodes[$nodeIds[1]]) ? $nodes[$nodeIds[1]] : NULL, ];
To avoid the warning you need extensive logic. E.g:
if (count(array_filter($nodeIds)) === 2) { $nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($nodeIds); } elseif (!empty($nodeIds[0])) { $nodes = [ $this->entityTypeManager->getStorage('node')->load($nodeIds[0]), NULL, ]; } elseif (!empty($nodeIds[1])) { $nodes = [ NULL, $this->entityTypeManager->getStorage('node')->load($nodeIds[1]), ]; }
But if you would have 3, 4, 5 entities to load multiple single loads would be needed.
I'm not demanding changes, just wanted to point out to this DX
- Status changed to Needs review
5 months ago 9:22am 4 August 2024 - Status changed to Needs work
5 months ago 11:59pm 4 August 2024 - 🇺🇸United States smustgrave
Current development branch is 11.x and changes should be in MRs
- 🇮🇳India rakshith.thotada
Removing the patch as we already have the patch here https://www.drupal.org/files/issues/2023-01-12/3145190-21.patch →