Browse Source

Merge branch 'sql_criteria' of dimti.ru:majestic into sql_criteria

namespace
Alexander Demidov 11 years ago
parent
commit
0b0dc61960
  1. 6
      model/SqlCriteria.php

6
model/SqlCriteria.php

@ -80,7 +80,11 @@ class SqlCriteria
public function count() public function count()
{ {
$this->sql_expression = 'SELECT COUNT(*) as count FROM :table';
if ($this->sql_expression && strpos($this->sql_expression, 'COUNT(*) as count')) {
;
} else {
$this->sql_expression = 'SELECT COUNT(*) as count FROM :table';
}
$this->defineJoinExpressions(); $this->defineJoinExpressions();
return $this->model->find(array(), '', $this->where, null, null, null, null, $this->sql_expression, $this->sql_expression_params)->fetchField('count'); return $this->model->find(array(), '', $this->where, null, null, null, null, $this->sql_expression, $this->sql_expression_params)->fetchField('count');
} }

Loading…
Cancel
Save