Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Only check for existing method expresion() when it actually will be c…

…alled.

Datasources that use calculate() should not be forced to implement expression() as well
  • Loading branch information...
commit 30268f6a081323e67dfa28420d8165ea9c6b0ab6 1 parent 8c631fa
@ceeram ceeram authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Cake/Model/Model.php
View
4 lib/Cake/Model/Model.php
@@ -2749,12 +2749,12 @@ protected function _findCount($state, $query, $results = array()) {
if ($state === 'before') {
$db = $this->getDataSource();
$query['order'] = false;
- if (!method_exists($db, 'calculate') || !method_exists($db, 'expression')) {
+ if (!method_exists($db, 'calculate')) {
return $query;
}
if (empty($query['fields'])) {
$query['fields'] = $db->calculate($this, 'count');
- } elseif (is_string($query['fields']) && !preg_match('/count/i', $query['fields'])) {
+ } elseif (method_exists($db, 'expression') && is_string($query['fields']) && !preg_match('/count/i', $query['fields'])) {
$query['fields'] = $db->calculate($this, 'count', array(
$db->expression($query['fields']), 'count'
));

0 comments on commit 30268f6

Please sign in to comment.
Something went wrong with that request. Please try again.