Use having clause for part amountSum filter constraint

This fixes issue #218
This commit is contained in:
Jan Böhmer 2023-02-19 21:45:38 +01:00
parent ccb0ac63e1
commit 2d85734703

View file

@ -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');