Permalink
Browse files

Fix the `'joined'` strategy of `data\source\Database` to allow object…

… casted field.
  • Loading branch information...
1 parent d0acd17 commit 2ad6e529295a066d87c1b92f8dce49e181ea69ea @jails jails committed Dec 21, 2012
Showing with 4 additions and 1 deletion.
  1. +3 −0 data/source/Database.php
  2. +1 −1 tests/cases/data/source/DatabaseTest.php
View
@@ -232,6 +232,9 @@ public function __construct(array $config = array()) {
$models = $context->models();
foreach ($context->fields() as $field) {
+ if (!is_string($field)) {
+ continue;
+ }
list($alias, $field) = $self->invokeMethod('_splitFieldname', array($field));
$alias = $alias ?: $field;
if ($alias && isset($models[$alias])) {
@@ -1506,7 +1506,7 @@ public function testCustomField() {
$query = new Query(array(
'type' => 'read',
'model' => $this->_gallery,
- 'fields' => array('count(Image.id) as count', 'Image'),
+ 'fields' => array((object) 'count(Image.id) as count', 'Image'),
'group' => 'Gallery.id',
'with' => array('Image')
));

0 comments on commit 2ad6e52

Please sign in to comment.