You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AndreasA
changed the title
SortableListener uses wrong compareTo check if Comparable is used
[Sortable] SortableListener uses wrong compareTo check if Comparable is used
Nov 30, 2022
In https://github.com/doctrine-extensions/DoctrineExtensions/blob/v3.10.0/src/Sortable/SortableListener.php#L266
the sortable listener uses
compareTo
to find out if the object of the group is matching.However, the corresponding interface https://github.com/doctrine/common/blob/3.4.3/src/Comparable.php
says it should return
0
upon a match and1
/-1
according to sorting as that interface could also be used for sorting.In combination with https://github.com/doctrine-extensions/DoctrineExtensions/blob/main/src/Sortable/SortableListener.php#L275 the sortable listener expects
$matches
to be a boolean value (or at least 1 and not 0).see also:
DoctrineExtensions/src/Sortable/SortableListener.php
Line 460 in ea1e025
There was a previous PR #2185 but that was never merged - probably as the one comment was never fixed.
The text was updated successfully, but these errors were encountered: