item() public method

Returns a newly-created Document object, bound to a model and populated with default data and options.
public item ( string $model, array $data = [], array $options = [] ) : object
$model string A fully-namespaced class name representing the model class to which the `Document` object will be bound.
$data array The default data with which the new `Document` should be populated.
$options array Any additional options to pass to the `Document`'s constructor
return object Returns a new, un-saved `Document` object bound to the model class specified in `$model`.
示例#1
0
 public function testItem()
 {
     $couchdb = new CouchDb($this->_testConfig);
     $data = array('_id' => 'a1', '_rev' => '1-2', 'author' => 'author 1', 'body' => 'body 1');
     $expected = array('id' => 'a1', 'rev' => '1-2', 'author' => 'author 1', 'body' => 'body 1');
     $item = $couchdb->item($this->query->model(), $data);
     $result = $item->data();
     $this->assertEqual($expected, $result);
 }