public function testFieldsWithJoins()
{
$db = $this->_db;
$this->skipIf(!$db::enabled('relationships'));
$this->skipIf($this->with(array('MongoDb')));
$new = Galleries::create(array('name' => 'Celebrities'));
$cKey = Galleries::meta('key');
$result = $new->save();
$this->assertTrue($result);
$cId = (string) $new->{$cKey};
$new = Images::create(array('gallery_id' => $cId, 'title' => 'John Doe'));
$eKey = Images::meta('key');
$result = $new->save();
$this->assertTrue($result);
$eId = (string) $new->{$eKey};
$entity = Galleries::first(array('with' => 'Images', 'conditions' => array('Galleries.id' => $cId), 'fields' => array('Galleries' => array('name'), 'Images' => array('id', 'title'))));
$expected = array('id' => $cId, 'name' => 'Celebrities', 'images' => array(array('id' => $eId, 'title' => 'John Doe')));
$this->assertEqual($expected, $entity->data());
}