Browse Source

Correct count in SqlCriteria (fix1)

namespace
Alexander Demidov 10 years ago
parent
commit
d5a2da7cbf
  1. 2
      Model/SqlCriteria.php

2
Model/SqlCriteria.php

@ -89,7 +89,7 @@ class SqlCriteria
$this->sql_expression = 'SELECT COUNT(' . ($select ? $select : '*') . ') as count FROM :table';
$select_parent_query = 'x.count';
} else {
$this->sql_expression = preg_replace('#SELECT.+FROM#', 'SELECT COUNT(' . ($select ? $select : '*') . ') as count FROM', $this->sql_expression);
$this->sql_expression = preg_replace('#SELECT.+FROM#i', 'SELECT COUNT(' . ($select ? $select : '*') . ') as count FROM', $this->sql_expression);
}
$count = $this->model->count($select_parent_query, $this->where, null, $this->group_by, $this->sql_expression, $this->sql_expression_params)->fetchField('count');
$this->sql_expression = $sql_expression_backup;

Loading…
Cancel
Save