Permalink
Browse files

Added support for Model::find($id)

  • Loading branch information...
1 parent acd74d3 commit f8a9d38601bfe2b6308bfe38c2c0433a86e458ae @phishy phishy committed Jan 25, 2013
Showing with 7 additions and 2 deletions.
  1. +2 −1 extensions/data/source/Couchbase.php
  2. +5 −1 tests/integration/data/CrudExtendedTest.php
@@ -251,6 +251,7 @@ public function read($query, array $options = array()) {
))));
$key = $model::key();
+ $viewName = '';
$prefix = (Environment::get() == 'production') ? '' : 'dev_';
if (!$conditions) {
@@ -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;
});
@@ -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()));

0 comments on commit f8a9d38

Please sign in to comment.