Skip to content

Commit

Permalink
Added support for Model::find($id)
Browse files Browse the repository at this point in the history
  • Loading branch information
phishy committed Jan 25, 2013
1 parent acd74d3 commit f8a9d38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion extensions/data/source/Couchbase.php
Expand Up @@ -251,6 +251,7 @@ public function read($query, array $options = array()) {
))));
$key = $model::key();

$viewName = '';
$prefix = (Environment::get() == 'production') ? '' : 'dev_';

if (!$conditions) {
Expand Down Expand Up @@ -283,7 +284,7 @@ public function read($query, array $options = array()) {

if ($result = json_decode($data, true)) {
$config = compact('query') + array('exists' => true);
return $this->item($model, array('data' => $result), $config);
return $self->item($model, array('data' => $result), $config);
}
return false;
});
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/data/CrudExtendedTest.php
Expand Up @@ -145,7 +145,11 @@ public function testFindByView() {
$company1 = Companies::create($this->data[0]);
$company1->save();
$company2 = Companies::create($this->data[1]);
$company2->save();;
$company2->save();

$company = Companies::find($company1->id);
$data = $company->data();
$this->assertEqual('Marine Store', $data['name']);

$companies = Companies::find('by_active');
$this->assertEqual(2, count($companies->data()));
Expand Down

0 comments on commit f8a9d38

Please sign in to comment.