mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
24ed6150cf
commit
9c55927a17
@ -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.
|
||||
*/
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user