BUG Don't sort when deleting records in ManyManyList::removeAll()

This breaks databases like MSSQL which don't allow an ORDER BY with
a subquery at the same time. DELETE queries don't need to be ordered,
so we can safely remove the default.
This commit is contained in:
Sean Harvey 2013-04-05 11:50:25 +13:00
parent ceb7e3c8a8
commit 65cb182c98

View File

@ -181,6 +181,7 @@ class ManyManyList extends RelationList {
unset($from[$this->joinTable]);
$query->setFrom($from);
$query->setDistinct(false);
$query->setOrderBy(null, null); // ensure any default sorting is removed, ORDER BY can break DELETE clauses
// Use a sub-query as SQLite does not support setting delete targets in
// joined queries.