mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-04 08:10:26 +00:00
Fix issue BookStackApp#5542 Sorting by name
This commit is contained in:
parent
0ec0913846
commit
abe7467ae5
2 changed files with 5 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace BookStack\Sorting;
|
namespace BookStack\Sorting;
|
||||||
|
|
||||||
|
use voku\helper\ASCII;
|
||||||
use BookStack\Entities\Models\Chapter;
|
use BookStack\Entities\Models\Chapter;
|
||||||
use BookStack\Entities\Models\Entity;
|
use BookStack\Entities\Models\Entity;
|
||||||
|
|
||||||
|
@ -13,12 +14,12 @@ class SortSetOperationComparisons
|
||||||
{
|
{
|
||||||
public static function nameAsc(Entity $a, Entity $b): int
|
public static function nameAsc(Entity $a, Entity $b): int
|
||||||
{
|
{
|
||||||
return strtolower($a->name) <=> strtolower($b->name);
|
return strtolower(ASCII::to_transliterate($a->name)) <=> strtolower(ASCII::to_transliterate($b->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function nameDesc(Entity $a, Entity $b): int
|
public static function nameDesc(Entity $a, Entity $b): int
|
||||||
{
|
{
|
||||||
return strtolower($b->name) <=> strtolower($a->name);
|
return strtolower(ASCII::to_transliterate($b->name)) <=> strtolower(ASCII::to_transliterate($a->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function nameNumericAsc(Entity $a, Entity $b): int
|
public static function nameNumericAsc(Entity $a, Entity $b): int
|
||||||
|
|
|
@ -198,6 +198,8 @@ class SortRuleTest extends TestCase
|
||||||
$namesToAdd = [
|
$namesToAdd = [
|
||||||
"Beans",
|
"Beans",
|
||||||
"bread",
|
"bread",
|
||||||
|
"Éclaire",
|
||||||
|
"egg",
|
||||||
"Milk",
|
"Milk",
|
||||||
"pizza",
|
"pizza",
|
||||||
"Tomato",
|
"Tomato",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue