API CHANGE: Replaced ManyManyList::removeByFilter() with ManyManyList::removeAll().

This commit is contained in:
Sam Minnee 2011-10-29 17:23:53 +13:00
parent 6a3aac25a7
commit 085598fac0
2 changed files with 7 additions and 7 deletions

View File

@ -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) {

View File

@ -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();
}