API CHANGE Removed ComponentSet::removeByFilter() since it's not flexible enough and fixed calls to this from HtmlEditorField::saveInto() to use custom code instead

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@93660 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-11-26 22:07:45 +00:00 committed by Sam Minnee
parent 24ed6150cf
commit 9c55927a17
2 changed files with 9 additions and 17 deletions

View File

@ -256,16 +256,6 @@ class ComponentSet extends DataObjectSet {
}
}
/**
* 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,7 +131,8 @@ 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));
@ -139,7 +140,8 @@ 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));
$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) {