If I run this,
->addSelect(new Expression('IFNULL(SUM(supply), 0) AS sum_supply'))
it generates
IFNULL(SUM(supply), `0` AS `sum_supply` FROM ...
which is an invalid request, backstep around 0.
How do I delete this answer?
Quick fix:
->addSelect([new Expression('IFNULL(SUM(supply), 0) AS sum_supply')])
or
->addSelect(['IFNULL(SUM(supply), 0) AS sum_supply'])
An array should be used in this case because it addSelect() separates the input string with a comma
addSelect()