Hello, I am keep getting this error
SQLSTATE[42883]: Undefined function: 7 ERROR: function avg() does not exist LINE 1: SELECT AVG(*) AS "average" FROM "system"."user_rating" ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.
My model function looks like:
public function countAverage() { $rating=User_Rating::average(array( [ 'columns' => 'rating' ] )); return $rating; }
I call it from controller: $rating = new \Models\User; $avgUser = $rating->countAverage();
$this -> view -> users = $avgUser;
var_dump($avgUser);
die;
My rating column is real type, phalcon function average returns and takes double value. What I am doing wrong?