Browse Source

fix count method with saving original sql expression

namespace
Alexander Demidov 11 years ago
parent
commit
776859b3c8
  1. 4
      Model/SqlCriteria.php

4
Model/SqlCriteria.php

@ -81,9 +81,11 @@ class SqlCriteria
public function count($select = 'x') public function count($select = 'x')
{ {
$this->defineJoinExpressions();
$sql_expression_backup = $this->sql_expression; $sql_expression_backup = $this->sql_expression;
if ($select) {
$this->select( $select ); $this->select( $select );
$this->defineJoinExpressions();
}
if (!$this->sql_expression) { if (!$this->sql_expression) {
$this->sql_expression = 'SELECT COUNT(*) as count FROM :table'; $this->sql_expression = 'SELECT COUNT(*) as count FROM :table';
} }

Loading…
Cancel
Save