Permalink
Browse files

Fix issue with find(count) and TranslateBehavior.

Fixes #2667
  • Loading branch information...
1 parent 7a27650 commit 55e1619c59e5b01fcb540de468bce3dd3884d170 @markstory markstory committed Jan 19, 2014
@@ -305,7 +305,7 @@ public function afterFind(Model $Model, $results, $primary = false) {
}
} else {
$value = '';
- if (is_numeric($row[$Model->alias][$aliasVirtual]) || !empty($row[$Model->alias][$aliasVirtual])) {
+ if (isset($row[$Model->alias][$aliasVirtual])) {
$value = $row[$Model->alias][$aliasVirtual];
}
$row[$Model->alias][$aliasField] = $value;
@@ -285,7 +285,9 @@ public function testLocaleSingleCountWithConditions() {
$TestModel = new TranslatedItem();
$TestModel->locale = 'eng';
- $result = $TestModel->find('all', array('conditions' => array('slug' => 'first_translated')));
+ $result = $TestModel->find('all', array(
+ 'conditions' => array('slug' => 'first_translated')
+ ));
$expected = array(
array(
'TranslatedItem' => array(
@@ -300,10 +302,12 @@ public function testLocaleSingleCountWithConditions() {
);
$this->assertEquals($expected, $result);
- $result = $TestModel->find('count', array('conditions' => "TranslatedItem.slug = 'first_translated'"));
+ $result = $TestModel->find('count', array(
+ 'conditions' => array('slug' => 'first_translated')
+ ));
$expected = 1;
$this->assertEquals($expected, $result);
- }
+ }
/**
* testLocaleSingleAssociations method

0 comments on commit 55e1619

Please sign in to comment.