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
@ -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.
|
* Remove all items in this set.
|
||||||
*/
|
*/
|
||||||
|
@ -131,7 +131,8 @@ class HtmlEditorField extends TextareaField {
|
|||||||
|
|
||||||
// Save file & link tracking data.
|
// Save file & link tracking data.
|
||||||
if($record->ID && $record->many_many('LinkTracking') && $tracker = $record->LinkTracking()) {
|
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) {
|
if($linkedPages) foreach($linkedPages as $item) {
|
||||||
$tracker->add($item, array('FieldName' => $this->name));
|
$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()) {
|
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;
|
$fieldName = $this->name;
|
||||||
if($linkedFiles) foreach($linkedFiles as $item) {
|
if($linkedFiles) foreach($linkedFiles as $item) {
|
||||||
|
Loading…
Reference in New Issue
Block a user