sum()
and average()
function on Phalcon\Mvc\Model, not return value if not matched any results like following query:
$transactions_today = Transactions::sum(
[
'column' => 'total',
"conditions" => "status = :status: AND DATE(created) >= :start_date: AND DATE(created) <= :end_date:",
"bind" => [
'status' => true,
'start_date' => date('Y-m-d'),
'end_date' => date('Y-m-d')
]
]
);
Is there any feature return default value like that?
'defaultValue' => 0