From 631b8bcaf8b9c7cf92a0b2a1d6ae75ec8afb558c Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 5 Dec 2022 15:18:54 +1300 Subject: [PATCH] DOC DataList::sort() and orderBy() --- en/04_Changelogs/5.0.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/en/04_Changelogs/5.0.0.md b/en/04_Changelogs/5.0.0.md index dc14b3fe0..b2dee705c 100644 --- a/en/04_Changelogs/5.0.0.md +++ b/en/04_Changelogs/5.0.0.md @@ -164,6 +164,8 @@ This is a major release and as a result there are a number of breaking API chang ### ORM {#api-orm} +- [DataList::sort()](api:SilverStripe\ORM\DataList) No longer accepts raw SQL. A new method `DataList::orderBy()` has been created which accepts raw SQL, though it's recommended to continue using `DataList::sort()` if possible to reduce the chance of SQL injection vulnerabilities. +- Passing `null` to `DataList::sort()` i.e. `sort(null)` will now clear any existing sort values on a DataList. Passing an empty string i.e. `sort('')` or array i.e. `sort([])` will now cause an exception to be thrown. - Prior to 5.0.0, when using `SQLSelect::setFrom()` or `SQLSelect::create('*', $from)` to set table or subselect definitions, their aliases (applied by setting a string key for the array) were being ignored. This bug has been fixed - if you were working around this by manually setting the alias e.g. in a join, you can remove those workarounds now. - [Query](api:SilverStripe\ORM\Connect\Query) now implements `IteratorAggregate` instead of `Iterator`. This means `seek()` and other iterator methods are no longer available on this class and its subclasses. Use `getIterator()` instead.