From 2d85734703fc6e45279afbd9de3d29dd43a6520e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 19 Feb 2023 21:45:38 +0100 Subject: [PATCH] Use having clause for part amountSum filter constraint This fixes issue #218 --- src/DataTables/Filters/PartFilter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DataTables/Filters/PartFilter.php b/src/DataTables/Filters/PartFilter.php index 2a689a8b..dabf005e 100644 --- a/src/DataTables/Filters/PartFilter.php +++ b/src/DataTables/Filters/PartFilter.php @@ -105,7 +105,8 @@ class PartFilter implements FilterInterface This seems to be related to the fact, that PDO does not have an float parameter type and using string type does not work in this situation (at least in SQLite) TODO: Find a better solution here */ - $this->amountSum = new IntConstraint('amountSum'); + //We have to use Having here, as we use an alias column which is not supported on the where clause and would result in an error + $this->amountSum = (new IntConstraint('amountSum'))->useHaving(); $this->lotCount = new IntConstraint('COUNT(partLots)'); $this->storelocation = new EntityConstraint($nodesListBuilder, Storelocation::class, 'partLots.storage_location');