CompleteLister::updateGrandTotals PHP Метод

updateGrandTotals() публичный Метод

Called one time on rendering phase - before renderRows() call.
public updateGrandTotals ( )
    public function updateGrandTotals()
    {
        // get model
        $m = $this->getIterator();
        // create DSQL query for sum and count request
        $fields = array_keys($this->totals);
        // select as sub-query
        $sub_q = $m->dsql()->del('limit')->del('order');
        $q = $this->app->db->dsql();
        //->debug();
        $q->table($sub_q, 'grandTotals');
        // alias is mandatory if you pass table as DSQL
        foreach ($fields as $field) {
            $q->field($q->sum($field), $field);
        }
        $q->field($q->count(), 'total_cnt');
        // execute DSQL
        $data = $q->getHash();
        // parse results
        $this->total_rows = $data['total_cnt'];
        unset($data['total_cnt']);
        $this->totals = $data;
    }