Exemple #1
0
 public function postAdd($p, $z)
 {
     $doc = new CouchDocument($_POST['id']);
     foreach ($_POST as $key => $value) {
         $doc->{$key} = $value;
     }
     $doc->save();
     $this->redirect('list');
 }
 public function buildObjectFromResponse(CouchResponse $response)
 {
     if (!$response->getSource() instanceof CouchDb) {
         throw new CouchException("Can only build a document object from a database source, a '" . get_class($response->getSource()) . "' source object was provided");
     }
     return CouchDocument::create($response->getSource(), $response->getBody());
 }
 public function offsetSet($id, $doc)
 {
     if (!$doc instanceof CouchDocument) {
         $doc = CouchDocument::create($this, $doc);
     }
     $doc->id = $id;
     $doc->save();
 }