- Issue created by @bnjmnm
- First commit to issue fork.
- πΊπΈUnited States mglaman WI, USA
I see why this was done, now. You can't unset previously defined sorts.
\Drupal\Core\Entity\EntityListBuilder::getEntityListQuery
does:->sort($this->entityType->getKey('id'));
Any other sort calls would sort secondary to that one.
Opening an MR that uses a query tag to alter the query and fix the sorts. It's not great but the only option.
- Status changed to Needs review
8 months ago 4:38pm 2 May 2024 - Status changed to Needs work
8 months ago 1:43pm 7 May 2024 - Status changed to Needs review
7 months ago 3:48pm 4 June 2024 - πΊπΈUnited States mglaman WI, USA
It feels more of a coding standard / PHPStan rule than test coverage. After reading π± [policy, no patch] Better scoping for bug fix test coverage RTBC it seems like this could be a bugfix without a test, but should have a follow up for preventing this kinds of changes in entity list builders.
Does the issue expose a general lack of test coverage for the specific subsystem? If so, is it better to add generic test coverage for that subsystem in a separate issue?
Also, this is true:
Is the fix achieved without adding new, untested, code paths?
- πΊπΈUnited States smustgrave
Mind updating proposed solution
Fine with moving generic test coverage to a follow up.
- Status changed to RTBC
7 months ago 2:01pm 10 June 2024 - πΊπΈUnited States smustgrave
Went ahead and opened the follow up.
Tweaked summary some.
But change didn't break anything and does seem like the policy could apply.
- πΊπΈUnited States mglaman WI, USA
Thanks for opening, added notes there. Sorry, it's been on my list but kept getting buried.
- First commit to issue fork.
- Status changed to Needs review
7 months ago 10:18am 12 June 2024 - π¬π§United Kingdom alexpott πͺπΊπ
Given this is not going to make 10.2.x can I suggest that we fix the original problem in a more generic and easier to override way - see https://git.drupalcode.org/project/drupal/-/merge_requests/8388
- πΊπΈUnited States smustgrave
Oh nice so all you have to do is set a key. +1 from me but will let #mglaman mark it since he opened the issue.
- Status changed to RTBC
7 months ago 2:42pm 12 June 2024 - π¬π§United Kingdom alexpott πͺπΊπ
alexpott β changed the visibility of the branch 3410091-regression-menu-list to hidden.
- π³πΏNew Zealand quietone
I read the issue summary, comments and the MR. I don't see any unanswered questions or missing core gate requirements. However, the proposed resolution is now incorrect.
Thanks to alexpott for the simple, flexible solution.
I have update the proposed resolution but I do have one question, about naming. Would it be better if the constant was something like 'ENTITY_SORT_KEY' or even 'ENTITY_QUERY_SORT_KEY' so that it is even more explicit when this key can be used.
- π¬π§United Kingdom alexpott πͺπΊπ
I think the constant name is fine because it is protected (so not part of the public API) and inline with \Drupal\Core\Entity\EntityListBuilder::$limit - the whole class is about listing entities so adding entity to it's name doesn't give us much.
- Status changed to Fixed
6 months ago 9:21am 10 July 2024 - π¬π§United Kingdom catch
Committed/pushed to 11.x and cherry-picked to 10.4.x and 11.0.x. I didn't backport to 10.3.x because it's a new constant in classes that contrib can subclass.
Automatically closed - issue fixed for 2 weeks with no activity.