API CHANGE: removed deprecated removeByFilter() function

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@93670 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Will Rossiter 2009-11-26 22:18:59 +00:00
parent 66c8dab01a
commit 05832a1dee
2 changed files with 9 additions and 17 deletions

View File

@ -255,17 +255,7 @@ class ComponentSet extends DataObjectSet {
DB::query("DELETE FROM \"$this->tableName\" WHERE \"$parentField\" = {$this->ownerObj->ID} AND \"$childField\" IN ($itemCSV)");
}
}
/**
* Remove all items that match the SQL filter.
* @deprecated 2.3 Not flexible enough, use custom code
* @param string $filter Filter to be inserted into the WHERE clause
*/
function removeByFilter($filter) {
$parentField = $this->ownerClass . 'ID';
DB::query("DELETE FROM \"$this->tableName\" WHERE \"$parentField\" = {$this->ownerObj->ID} AND $filter");
}
/**
* Remove all items in this set.
*/

View File

@ -131,17 +131,19 @@ class HtmlEditorField extends TextareaField {
// Save file & link tracking data.
if($record->ID && $record->many_many('LinkTracking') && $tracker = $record->LinkTracking()) {
$tracker->removeByFilter(sprintf('"FieldName" = \'%s\' AND "SiteTreeID" = %d', $this->name, $record->ID));
$filter = sprintf('"FieldName" = \'%s\' AND "SiteTreeID" = %d', $this->name, $record->ID);
DB::query("DELETE FROM \"$tracker->tableName\" WHERE $filter");
if($linkedPages) foreach($linkedPages as $item) {
$tracker->add($item, array('FieldName' => $this->name));
}
}
if($record->ID && $record->many_many('ImageTracking') && $tracker = $record->ImageTracking()) {
$tracker->removeByFilter(sprintf('"FieldName" = \'%s\' AND "SiteTreeID" = %d', $this->name, $record->ID));
$fieldName = $this->name;
$filter = sprintf('"FieldName" = \'%s\' AND "SiteTreeID" = %d', $this->name, $record->ID);
DB::query("DELETE FROM \"$tracker->tableName\" WHERE $filter");
$fieldName = $this->name;
if($linkedFiles) foreach($linkedFiles as $item) {
$tracker->add($item, array('FieldName' => $this->name));
}
@ -149,7 +151,7 @@ class HtmlEditorField extends TextareaField {
$record->{$this->name} = $htmlValue->getContent();
}
/**
* @return HtmlEditorField_Readonly
*/