используя виртуальные поля для суммирования значений в cakephp

Я пытаюсь получить сумму голосов за данного пользователя.

Скажи, что это стол сообщений

id | body  | user_id | vote_total | type
1    test     1          4          new
2    test2    1          3          new
3    test3    2          2          new

Я пытаюсь получить следующий вывод

user_id  | vote_total
 1          7
 2          2

Вот моя функция в PostsController

 public function topvotes(){ 
    $virtualFields = array('total' => 'SUM(Post.vote_total)');
    $total = $this->Post->find('all', array(
                            array('fields' => array('total'), 
                            'recursive' => 1,
                            'group' => array('Post.user_id'),
                            'conditions'=>array('Post.type' => 'new' ))));

    $post = $this->Post->find('all', $total);
    $this->set('posts', $post);
}

Этот запрос работает (я пытался с phpmyadmin), но я не могу понять, как получить доступ к полученному массиву

edit I got it to work using the following query

$query = $this->Post->query("select posts.user_id, SUM(Posts.vote_total) from posts where posts.type = 'new' group by posts.user_id");
    $this->set('posts', $query);

когда я печатаю print_r это массив

Array ( [posts] => Array ( [user_id] => 7 ) [0] => Array ( [total] => 6 ) ) 1

Ответы на вопрос(2)

Ваш ответ на вопрос