Hello i have a problem to display Model result in Volt:
Controller:
$totalLikes = $this->modelsManager->createBuilder()
->columns(["totalLikesDB"=>"SUM(l.likeClicks)"])
->from(["u" => "Vokuro\Models\Users", "l" => "Vokuro\Models\Likes"])
->where("u.id = l.usersId")
->groupBy("u.id")
->getQuery()
->execute();
$this->view->setVar("totalLikes", $totalLikes);
Generated SQL:
SELECT SUM(`l`.`likeClicks`) AS `totalLikesDB` FROM `users` AS `u`, `likes` AS `l` WHERE `u`.`id` = `l`.`usersId` GROUP BY `u`.`id`
Volt:
{{ totalLikes.totalLikesDB }}
Error:
Catchable fatal error: Object of class Phalcon\Mvc\Model\Resultset\Simple could not be converted to string