in a project with 2.2.7 there is code like this:
$select->where->expression('CXORDERNUMBER = "' . $orderNumber . '"', null);
When trying to update this for 2.4.9 I get the following error:
*Zend\Db\Sql\Exception\RuntimeException
The number of replacements in the expression does not match the number of parameters*
I had to change it to the following, which is also more familiar to me:
$select->where(array("CXORDERNUMBER" => $orderNumber));
There are many of these expressions in the code. Sometimes it is not possible for me to change it in the way above. Can someone explain me, why this happens in the newer version of ZF?
Thanks!
Update:
The expression must be used like this: $select->where->expression('CXORDERNUMBER = ?', array($orderNumber));
In 2.4.9 there is always a parameter set and not ignored as in 2.2.7 with a null-Value