I have this function:
public function updateNumberOfProduct($productId, $type='+') {
if ( $type == '+' )
$number = 1;
else
$number = -1;
$di = \Phalcon\DI::getDefault();
$productPHQL = new Query(
"UPDATE \App\Model\Products SET \App\Model\Products.number = \App\Model\Products.number + :number:
WHERE \App\Model\Products.product_id = :product_id: AND \App\Model\Products.number > 0",
$di
);
$result = $productPHQL->execute(
[
"number" => $number,
"product_id" => $productId
]
);
}
When executed, I saw this error: Invalid parameter number: number of bound variables does not match number of tokens
What did I do wrong?
Thanks.