mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API CHANGE: Replaced ManyManyList::removeByFilter() with ManyManyList::removeAll().
This commit is contained in:
parent
6a3aac25a7
commit
085598fac0
@ -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) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user