/**
  *
  * @param string $viewName
  * @param array $queryOptions
  * @return mixed
  */
 protected function queryView($viewName, $queryOptions = array())
 {
     try {
         return $this->client->queryView($this->getDesignDocumentName(), $viewName, $queryOptions);
     } catch (\TYPO3\CouchDB\Client\NotFoundException $notFoundException) {
         $this->synchronize();
         return $this->client->queryView($this->getDesignDocumentName(), $viewName, $queryOptions);
     }
 }
示例#2
0
 /**
  * @test
  * @author Christopher Hlubek <*****@*****.**>
  */
 public function queryViewWithMultipleKeysWorks()
 {
     $this->client->createDocument(array('name' => 'Foo'));
     $this->client->createDocument(array('name' => 'Bar'));
     $this->client->createDocument(array('name' => 'Baz'));
     $this->client->createDocument(array('language' => 'javascript', 'views' => array('byName' => array('map' => 'function(doc) { if (doc.name) { emit(doc.name, null); } }'))), '_design/test');
     $response = $this->client->queryView('test', 'byName', array('keys' => array('Foo', 'Baz'), 'include_docs' => TRUE));
     $this->assertEquals(2, count($response->rows));
     $row = $response->rows[0];
     $this->assertEquals('Foo', $row->doc->name);
     $row = $response->rows[1];
     $this->assertEquals('Baz', $row->doc->name);
 }