From 085598fac03e1e6da2192a980c1e76f63b4f24b1 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 29 Oct 2011 17:23:53 +1300 Subject: [PATCH] API CHANGE: Replaced ManyManyList::removeByFilter() with ManyManyList::removeAll(). --- forms/HtmlEditorField.php | 2 +- model/ManyManyList.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 093d68b05..189aa3e70 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -152,7 +152,7 @@ class HtmlEditorField extends TextareaField { } if($record->ID && $record->many_many('ImageTracking') && $tracker = $record->ImageTracking()) { - $tracker->removeByFilter(sprintf('"FieldName" = \'%s\' AND "SiteTreeID" = %d', $this->name, $record->ID)); + $tracker->where(sprintf('"FieldName" = \'%s\' AND "SiteTreeID" = %d', $this->name, $record->ID))->removeAll(); $fieldName = $this->name; if($linkedFiles) foreach($linkedFiles as $item) { diff --git a/model/ManyManyList.php b/model/ManyManyList.php index ff2975736..9e1e7325a 100644 --- a/model/ManyManyList.php +++ b/model/ManyManyList.php @@ -127,14 +127,14 @@ class ManyManyList extends RelationList { } /** - * Remove all items from this many-many join that match the given filter - * @deprecated this is experimental and will change. Don't use it in your projects. + * Remove all items from this many-many join. To remove a subset of items, filter it first. */ - function removeByFilter($filter) { - Deprecation::notice('3.0', 'This is experimental and will change. Don\'t use it in your projects.'); - $query = new SQLQuery("*", array("\"$this->joinTable\"")); + function removeAll() { + $query = $this->dataQuery()->query(); $query->delete = true; - $query->where($filter); + $query->select = array('*'); + $query->from = array("\"$this->joinTable\""); + $query->orderby = null; $query->execute(); }