From 95b1c00ed9e0da11f231c59541337190336ae537 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 23 Sep 2021 16:34:53 +0200 Subject: [PATCH] fix ambiguous calls --- code/SoftDeleteSearchFilter.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/SoftDeleteSearchFilter.php b/code/SoftDeleteSearchFilter.php index ff84f66..d6a51ed 100644 --- a/code/SoftDeleteSearchFilter.php +++ b/code/SoftDeleteSearchFilter.php @@ -1,5 +1,6 @@ model = $query->applyRelation($this->relation); + $schema = DataObjectSchema::singleton(); + $tableName = $schema->tableName($this->model); $query = $query->setQueryParam("SoftDeletable.filter", false); if ($this->getOnlyDeleted() || $this->name == "OnlyDeleted") { - $query = $query->where("Deleted IS NOT NULL"); + $query = $query->where("\"$tableName\".\"Deleted\" IS NOT NULL"); } return $query; @@ -40,10 +43,12 @@ protected function applyOne(DataQuery $query) protected function applyMany(DataQuery $query) { $this->model = $query->applyRelation($this->relation); + $schema = DataObjectSchema::singleton(); + $tableName = $schema->tableName($this->model); $query = $query->setQueryParam("SoftDeletable.filter", false); if ($this->getOnlyDeleted() || $this->name == "OnlyDeleted") { - $query = $query->where("Deleted IS NOT NULL"); + $query = $query->where("\"$tableName\".\"Deleted\" IS NOT NULL"); } return $query; @@ -52,10 +57,12 @@ protected function applyMany(DataQuery $query) protected function excludeOne(DataQuery $query) { $this->model = $query->applyRelation($this->relation); + $schema = DataObjectSchema::singleton(); + $tableName = $schema->tableName($this->model); $query = $query->setQueryParam("SoftDeletable.filter", true); if ($this->getOnlyDeleted() || $this->name == "OnlyDeleted") { - $query = $query->where("Deleted IS NULL"); + $query = $query->where("\"$tableName\".\"Deleted\" IS NULL"); } return $query; @@ -64,10 +71,12 @@ protected function excludeOne(DataQuery $query) protected function excludeMany(DataQuery $query) { $this->model = $query->applyRelation($this->relation); + $schema = DataObjectSchema::singleton(); + $tableName = $schema->tableName($this->model); $query = $query->setQueryParam("SoftDeletable.filter", true); if ($this->getOnlyDeleted() || $this->name == "OnlyDeleted") { - $query = $query->where("Deleted IS NULL"); + $query = $query->where("\"$tableName\".\"Deleted\" IS NULL"); } return $query;